Computer Science Canada bouncing ball?? |
Author: | hpdudette [ Thu Jun 05, 2003 3:56 pm ] | ||
Post subject: | bouncing ball?? | ||
i'm trying to make this ball bounce in diagonally across the screen but i can't seem to figure out how to make it bounce back or bounce from top to bottom
|
Author: | PaddyLong [ Thu Jun 05, 2003 4:08 pm ] | ||
Post subject: | |||
easiest way to do a bouncing ball around the screen is something like this...
|
Author: | naoki [ Thu Jun 05, 2003 4:28 pm ] |
Post subject: | |
i use something like if ballx is near 0 or maxx then xchange := - xchange end if if bally is near 0 or maxy then ychange := ychange end if ballx += xchange bally += ychange this way only the increment by which you're moving the ball left/right, up/down will change from negative to positive, thus doing all the work for you |
Author: | PaddyLong [ Thu Jun 05, 2003 6:07 pm ] |
Post subject: | |
that's what mine is doing by multiplying it by -1 .. |