Laser and catch powerups bug
Closed this issue · 2 comments
When a laser and a catch powerup are activated at exactly the same time, it sometimes is possible to have a paddle that does both (releases ball and fires laser) when the spacebar is pressed.
This is happening when the laser and catch powerups strike the paddle simultaneously. The laser powerup activates the laser state, but the catch powerup immediately deactivates. The deactivation triggers transition back to normal state, but because the paddle never got to a laser state in the first place, the self._to_laser
flag was never set to False. This means the _convert_to_laser
function is called during the transition back to normal, which ends by registering the _fire()
handler. So you end up with a non-laser paddle which can fire laser bullets.
The fix is to ensure that the flag self._to_laser
is set to False in exit()
.
This should be driven out by a unit test.
Bug fixed plus unit test.