How to make a ball bounce in a parabola?
Posted: Sat May 27, 2006 7:00 am
How to make a ball bounce in a parabola after the ball reaches the bottom of the screen?
I wanted it to reach the bottom, bounce back up but not as high as the previous one and then reach the bottom of the screen and bounce back up in a parabola but this time lower than the previous height until the ball reaches the right end of the screen and stop and prints itself without dissapearing.
here is my coding but it only bounces up and down:
I wanted it to reach the bottom, bounce back up but not as high as the previous one and then reach the bottom of the screen and bounce back up in a parabola but this time lower than the previous height until the ball reaches the right end of the screen and stop and prints itself without dissapearing.
here is my coding but it only bounces up and down:
Code: Select all
REM This program makes a ball bounce less on each successive bounce
REM until it bounces not longer
REM Variable Dictionary
REM y.......y coordinate
rem x.......x coordinate
REM bounce..bounces to a certain height
REM count...counts to a certain range
SCREEN 12
CLS
bounce = 20
y = 30
x = 21
DO
y = y + 1
CIRCLE (x, y), 20, 14
PAINT (x, y), 14, 14
FOR count = 1 TO 5000
NEXT count
CIRCLE (x, y), 21, 0
CIRCLE (x, y), 0, 0
IF y = 460 THEN
DO
y = y - 1
CIRCLE (x, y), 20, 14
PAINT (x, y), 14, 14
FOR count = 1 TO 5000
NEXT count
CIRCLE (x, y), 21, 0
PAINT (x, y), 14, 0
IF bounce = y THEN EXIT DO
LOOP
bounce = bounce + 60
IF bounce > 460 THEN EXIT DO
END IF
LOOP
END