Problem designing bouncy ball program
Author |
Message |
amear
|
Posted: Wed Dec 11, 2002 10:21 pm Post subject: Problem designing bouncy ball program |
|
|
For the past while I have been trying to come up with a program containing a ball bouncing across a screen, with gravity taken into consideration. This is as far as I've gotten:
setscreen ("graphics:vga")
const midx := maxx div 2
const midy := maxy div 2
const a := 1
var yy : real
var x, y, t : int := 0
for i : 1 .. 28
t := i
x += 10
y := maxy - ( (a * t * t) div 2)
drawfilloval (x, y, 14, 14, red)
delay (30)
cls
end for
const b := 1
for i : 27 .. 40
t := 28
x += 10
y := maxy - ( (b * t* t) div 2)
drawfilloval (x, y, 14, 14, red)
delay (30)
cls
end for
I was wondering is there was an easier way, or how to continue this, and if anyone knows, how? Thanks
Alex alexbarker49@hotmail |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Wed Dec 11, 2002 11:29 pm Post subject: (No subject) |
|
|
well this is just animation, so you'd have to continue drawing each frame manually... unless you actually design a single function using velocity (as in speed with direction).
I made a tutorial about pool game http://danco.no-ip.com/turing/viewtopic.php?t=129, it has to do with balls hitting each other and stuff... See if that helps. Atleast that describes how to use velocity. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|