Simple Bounce
theory
Simple Bounce AlgorithmWe can calculate a simple rebound angle of a ball on a paddle via the following algorithm:
Rebound angle = 180 – direction at collision

implementation
1. Draw spritesMake sure ball and paddle sprites are centred:

2. Add scripts
ball script:

paddle script:

questions
- adjust controls and speed for paddle to your pleasing. Do you prefer keyboard or mouse?
- try the breakout challenge below before you go improving this game