Hi, i'm new to greenfoot. I'm ask for your help about how to change my horizontal-positioned plane into vertical direction without rotate it. So, when the player press 'A' or 'D' on keyboard, it mill move forward and backward (i've already make that work). And when the player press 'W' or 'S' it will moving up and down,but i want it work without changing the rotation.
Here's my code for moving forward and backward :
I need your help and guide. Thanks before.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | public void act() { // This isn't work like what i want if (Greenfoot.isKeyDown( "w" )) { move(- 4 ); } // This isn't work like what i want too if (Greenfoot.isKeyDown( "s" )) { move( 4 ); } //Worked if (Greenfoot.isKeyDown( "a" )) { move(Greenfoot.getRandomNumber( 10 )*- 1 ); } //Worked if (Greenfoot.isKeyDown( "d" )) { move(Greenfoot.getRandomNumber( 10 )); } } |