0
To write codes by using javaScript for a bouncing ball in a rectangle ,The ball should bounce up and down,left to right.
Answers
4 Respostas
+ 1
https://code.sololearn.com/WMUnE2bDEN6n/?ref=app
Is this what you mean? If yes then here is the main idea:
Lets talk about the coordinates (x = Horizontal, y = Vertical)
The main idea of the program is, when the coordinate reach the end of your screen (For example your Horizontal phone size is 100), so when the X coordinate reach 100 (from 0), the ball should be bounced back so that coordinate will be decreased until it reach 0 again.
The same with the Y coordinate.
0
Thanks