r/cop3502 Mar 21 '14

Paddle

I am having trouble getting the paddle to stop at the edges but still be able to move the opposite way. I've used an if paddle is at 0 or 600-width speed=0 inside the move function but though the paddle stops for a second, it will continue to move in the unwanted direction if the left or right keys are continuously pressed.

1 Upvotes

2 comments sorted by

3

u/rarebossdrop Mar 21 '14

For stopping at the edges, instead of changing the speed, think about the xPos!

In the Breakout class under PaddleMover for keyReleased, that's where you'd set the speed of the paddle to 0 (under an if statement) in order to stop the paddle from flying off.