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

2013/9/5

General movement

QOP QOP

2013/9/5

#
Hello :) Im new to Greenfoot and i hope some of u can help me. They command i have so is : if (Greenfoot.isKeyDown("right")) move(1); if (Greenfoot.isKeyDown("left")) move(-1); if (Greenfoot.isKeyDown("up")) turn(3); if (Greenfoot.isKeyDown("down")) turn(-1); But it would be nice that if i hit arrow up, he only moved up, and not turn Can anyone please help me? :)
mattjames mattjames

2013/9/5

#
instead of "turn(3)" for up write setLocation(getX(),getY()-1); and for down write setLocation(getX(),getY()1);
You need to login to post a reply.