I need help fast... Processing game for final!
in
Programming Questions
•
10 months ago
So here is my code. I am totally lost on how to do this. Animation.png is a little loop of a character walking that continues when You move the mouse. What I want to do is, and if somebody can give me some code for this I would be SO. HAPPY. Is -
- make an image randomly generate on the screen, like.... 'apple.png' that the character, when she walks into it, it disappears.
-REVERSE the animation. No matter what way I move the mouse, she appears to walk forward.
Maybe have some sort of JUMP function. Like click to jump.
-speed up the character walking animation when i move the mouse more quickly.... increasing framerate...?
Here is my code this is PROCESSING 1.3 by the way... and this is how I have to do the animation I think there are simpler ways but yeaaah....
int value = mouseX;
boolean ismoving = false;
PImage[] animation = new PImage[24]
;
PImage BG;
int counter = 0;
float across = height/2;
float move = mouseX;
void setup() {
frameRate(20);
size(848, 423);
smooth();
for(int i=0; i<animation.length;i++) {
animation[i] = loadImage(i+".png");
BG = loadImage("bg.png");
}
}
void draw() {
background(BG);
noCursor();
move = mouseX;
image(animation[counter], move, across);
if(counter == 23)
counter = 0;
if(ismoving) {
counter++;
}
ismoving = false;
}
void mouseMoved() {
ismoving = true;
}
- make an image randomly generate on the screen, like.... 'apple.png' that the character, when she walks into it, it disappears.
-REVERSE the animation. No matter what way I move the mouse, she appears to walk forward.
Maybe have some sort of JUMP function. Like click to jump.
-speed up the character walking animation when i move the mouse more quickly.... increasing framerate...?
Here is my code this is PROCESSING 1.3 by the way... and this is how I have to do the animation I think there are simpler ways but yeaaah....
int value = mouseX;
boolean ismoving = false;
PImage[] animation = new PImage[24]
;
PImage BG;
int counter = 0;
float across = height/2;
float move = mouseX;
void setup() {
frameRate(20);
size(848, 423);
smooth();
for(int i=0; i<animation.length;i++) {
animation[i] = loadImage(i+".png");
BG = loadImage("bg.png");
}
}
void draw() {
background(BG);
noCursor();
move = mouseX;
image(animation[counter], move, across);
if(counter == 23)
counter = 0;
if(ismoving) {
counter++;
}
ismoving = false;
}
void mouseMoved() {
ismoving = true;
}
1