This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

TheKidChameleon
TheKidChameleon presents ...

2012/10/10

NinjaWorldV2.1.0

Need help correcting the animation for NinjaCat running left. Any helpful comments appreciated.

2684 views / 12 in the last 7 days

Tags: game demo with-source need help cabrillo,

open in greenfoot
Your browser does not support the canvas tag.
gusbus123gusbus123

2012/10/10

in your void control every time u use the keys: up,down and left you will still run through the check right key button. And when you dont have your right key down it will update the image. thats y every time you have u go left it will change the image to the left image then imediately change to the look right image.
gusbus123gusbus123

2012/10/10

heres one way of doing it. All i did was add a check for when one of those 4 keys are down that goes around their seperate checks, so the first line of this code. [code]if(Greenfoot.isKeyDown("up") || Greenfoot.isKeyDown("down") || Greenfoot.isKeyDown("left") || Greenfoot.isKeyDown("right")) { if (Greenfoot.isKeyDown("up")) { setLocation(getX(), getY() - 5); } if (Greenfoot.isKeyDown("down")) { setLocation(getX(), getY() + 5); } if (Greenfoot.isKeyDown("left")) { move(-5); runLeft(); facing = "left"; } if (Greenfoot.isKeyDown("right")) { move(5); runRight(); facing = "right"; } } else { updateImage(); }[/code]
TheKidChameleonTheKidChameleon

2012/10/11

Thanks for the help, it works much better now.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.