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

2011/12/15

OMG I'm stuck with some basic stuff!!! HELP ME PLZZ!!

b321234 b321234

2011/12/15

#
OK i give up.... I just wanted to let the character move but it just doesn't work!!! I only have a player subclass and a world subclass And in the player subclass I only have these codes. /** * Control the character */ public void controlPlayer() { if (Greenfoot.isKeyDown("left")) { setLocation(getX()-2,getY()); } if (Greenfoot.isKeyDown("right")) { setLocation(getX()+2,getY()); } if (Greenfoot.isKeyDown("up")) { setLocation(getX(),getY()-2); } if (Greenfoot.isKeyDown("down")) { setLocation(getX(),getY()+2); } } Yup... What should I do? GF really freaks me out...!
InuoeK InuoeK

2011/12/15

#
put the bulk of the code in the act method. You don't need to create a separate method for movement
darkmist255 darkmist255

2011/12/15

#
Are you making sure to write this in the act() method:
act()
{
controlPlayer();
}
b321234 b321234

2011/12/15

#
ARGHHHHH OHHHHH I get it now!!! MANY MANY THANKS GUYS... I've just started learning this shit lol
darkmist255 darkmist255

2011/12/15

#
Great :D!
You need to login to post a reply.