So I'm a little confused with how my "move" code is working in the code below.
It is from a scrolling style game that moves from bottom to top. What was supposed to happen was as you hit run the ship starts moving up the screen, when you hit the "w", the ship would slow down. Although it works, something I've done in the code has caused a weird reaction. In the line setLocation(getX(), getY()-1);, if getY was "0" it should be stationary. However "+4" makes it stationary, "0" moves quite fast and "+1" through "+3" continue to move up instead of down. The entire program was posted if you want to see the rest of the code. IT's called "Need help with my "move" issues"
1 2 3 4 5 6 7 8 | public void moveUp() { setLocation(getX(), getY()- 1 ); if (Greenfoot.isKeyDown( "w" )) { setLocation(getX(), getY()+ 6 ); } } |