When you release the left key or the right key, the ship does not stop moving until it hits the edge of the playing field. Let's fix that.
We'll override the Game class's onKeyReleased() method. This method is called when keys are released.
If the player's ship is moving, the onKeyReleased(Key) met
Space Invaders (Part 24/34)
- 3
Locked
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Agent Smith
9 October 2020, 10:55
1. The PlayerShip class must have a public getDirection() getter that returns the value of the direction field.
Seems pretty strange. I think Ship class should have this getter method, since direction is declared there. Also, it would be useful to have in the previous task, where we have to get Ship direction value in PlayerShip method move(), but it is a private field...
0
Branka
22 June 2020, 14:14
In the requirements:
not the onKeyPress(Key) method should be written, but onKeyReleased(Key).
0
Roman
26 June 2020, 05:52
Thanks, we'll fix it
0
Pack Mtd
1 April 2020, 16:39
PACK SWEET
0