Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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

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.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 2 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: