Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Bouncing Hockey PUCK
Author Message
singh007

Posted: Tue Jun 10, 2003 9:51 am   Post subject: Bouncing Hockey PUCK

Hello i really need ur help in turing. I want to make a hockey puck (circle) which slides diagonally across the screen and "bounces" off the the boards. Only a single puck should be visible at any given time. i should be able to enter if i want the puck to travel qucikly or slowly. I will be really thankfull to u if u can helo me out in this.

PHP God

Posted: Tue Jun 10, 2003 11:03 am   Post subject: (No subject)

So you are really just trying to make the bouncing ball program? that is easy

simply have two variables that designate directions (vert, horz) And when the balls center + or - radius equals 0 or the maximum x/y then have the direction switch. If dir = this then + or - the X center or Y center. Kind of hard to explain quickly. I can't really tell you the code cuz its exam time. I'm in grade nine so I don't have exams on compsci, I just asked my teach if i could try it.

Posted: Tue Jun 10, 2003 11:39 am   Post subject: (No subject)

lol its kind of like that. i found it kind of hard to understand so i'll try explaining it also.. have 2 variables, velocity x (moves on the horizontal) and velocity y (moves the puck/ball vertically) you would have them both equal because you want it to go on a diagonal. you also have 2 variables, one for the x coord of the ball and another for the y coord of the ball. you loop it and continously draw the ball while adding the velocity x to the x coord of the ball and add the velocity y to the y coord of the ball. then you have if statements checking to see if the ball has touched the top (maxy) the right(maxx) left (0) and the bottom (0). you check y to see if its hit the top/bottom. and x for the left and right. if it has then multiply the appropriate velocity variable by -1 so it will travel the opposite way
singh007

Posted: Tue Jun 10, 2003 1:41 pm   Post subject: BOUNCING HOCKEY PUCK

hey thanks

can u like be online like @ 5 so i can take ur help
bEcause i am really bad in turing so thas why i have asked for help
ACTUALLY I AM MAKING
A
With a help of Pixels and Grpahics a user would like to make a hockey puck which should be able to slide diagonally across the screen and bounces of the board. Only one single puck should be visible at any given time. The user should be able to enter whether he/she should like the puck to travel quickly or slowly.

i ll be thankfull to u if u can helpo me i dont actually nderstand what u said on the email. so i ll be thankfull to u if u can actually start me off in this i really realy need helop
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 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: