Computer Science Canada

Bouncing Hockey PUCK

Author:  singh007 [ 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.

THANKS AND REPLY SOON

Author:  PHP God [ Tue Jun 10, 2003 11:03 am ]
Post 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.

Author:  Blade [ Tue Jun 10, 2003 11:39 am ]
Post 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

Author:  singh007 [ 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


: