Sprite on pokemon game

#1

Hey I am fairly new to processing, and am trying to make a Pokemon game by the things I have learned so far. I am trying to add a sprite to it, so my character gets an animation when walking. Is there any simple possibility to add things like that, if so how? or explain. (I haven’t added a sprite yet by the way)

0 Likes

#2

I’d check out the example on the processing website, although it may be a bit confusing

https://processing.org/examples/animatedsprite.html

The idea is quite simple. All you need is to create a class that stores a list of images and iterating through the list with a pointer (some Integer) that should increase by 1 every frame and reset to 0 when done iterating through the list.

This can be done without the need for classes but will be cumbersome the more animations you include.

0 Likes

#3

PImage backgroundImage;
float trainerY=01;
float trainerX=10;
float speed=5;
PImage trainer;
import processing.sound.*;
SoundFile file;
final color colorBlack=color(0,0,0);
void setup(){
size(493,397);
backgroundImage=loadImage(“New_Bark_Town_HGSS.png”);
trainer=loadImage(“GOLD.png”);
file= new SoundFile(this,“12 new bark town.mp3”);
file.play();

}
void draw(){
size(493,397);
background(0);
image(backgroundImage,0,0);
image(trainer,trainerX,trainerY, 50,50);
}

void keyPressed(){
if(key==CODED)
{
if(keyCode==UP){
trainerY=trainerY-speed;
} else if(keyCode==DOWN){
trainerY=trainerY+speed;
} else if(keyCode==LEFT){
trainerX=trainerX-speed;
}else if(keyCode==RIGHT){
trainerX=trainerX+speed;
}

}
}
PImage backgroundImage;
float trainerY=01;
float trainerX=10;
float speed=5;
PImage trainer;
import processing.sound.*;
SoundFile file;
final color colorBlack=color(0,0,0);
void setup(){
size(493,397);
backgroundImage=loadImage(“New_Bark_Town_HGSS.png”);
trainer=loadImage(“GOLD.png”);
file= new SoundFile(this,“12 new bark town.mp3”);
file.play();

}
void draw(){
size(493,397);
background(0);
image(backgroundImage,0,0);
image(trainer,trainerX,trainerY, 50,50);
}

void keyPressed(){
if(key==CODED)
{
if(keyCode==UP){
trainerY=trainerY-speed;
} else if(keyCode==DOWN){
trainerY=trainerY+speed;
} else if(keyCode==LEFT){
trainerX=trainerX-speed;
}else if(keyCode==RIGHT){
trainerX=trainerX+speed;
}

}
}

0 Likes