How do you make a class with a spaceship...
in
Programming Questions
•
7 months ago
..changing pictures when keypressed right or left and goes bk to normal when its not?
this is wat i have so far, but not in the class yet
PImage images[];
int index;
int y;
void setup()
{
background (255);
size (500, 500);
images = new PImage[7];
images[0] = loadImage("spaceship2.jpg");
}
void draw()
{
background (255);
PImage a;
a = loadImage("spaceship2.jpg");
image(a, 170, 350);
if (keyPressed);
{
if (key==RIGHT);
{
PImage b;
b = loadImage("2.gif");
image(b, 170, 350+y);
}
}
}
it doesnt move right yet, and picture doesnt change
1