Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Problem designing bouncy ball program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
amear




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: