Hi :)
So, regarding the "Asteroids" game I'm trying to make two things happen but I can't figure it out.
The first thing is that I want my bullets to go where my "mouse cursor" is WHEN I press the "Left Mouse Button".
Secondly, I already changed the code so that the movement of the Spaceship is done by pressing "WASD" instead of using just 1 key to accelerate. The thing is that the Spaceship "instantly" turns to that direction and I want it to "smoothly" turn up/down/left/right.
What I'm trying to accomplish is very similar to this game (Link below), notice how the Spaceship moves and shoots, they're 2 independent things.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | private void checkKeys() { //for going down if (Greenfoot.isKeyDown( "S" )) { setRotation( 90 ); ignite(Greenfoot.isKeyDown( "S" )); } //for going up if (Greenfoot.isKeyDown( "W" )) { setRotation( 270 ); ignite(Greenfoot.isKeyDown( "W" )); } //for going left if (Greenfoot.isKeyDown( "A" )) { setRotation( 180 ); ignite(Greenfoot.isKeyDown( "A" )); } //for going right if (Greenfoot.isKeyDown( "D" )) { setRotation( 0 ); ignite(Greenfoot.isKeyDown( "D" )); } |