Posted: Tue Jan 13, 2009 5:54 pm Post subject: How to bounce a ball (oval) off a wall
I have a project due in a couple of days and i am trying to figure out how to make a ball move itself in a diagonal line, and when it hits a wall that it will be able to rebound back at the same angle that it hit the wall. i am completly new at turing and any help would be appreciated
Sponsor Sponsor
saltpro15
Posted: Tue Jan 13, 2009 6:16 pm Post subject: Re: How to bounce a ball (oval) off a wall
here's some pseudo code to get you started
code:
var velx, vely, posx, posy : int
if posx > maxx - 5 then
velx := -velx
elsif posx < 5
velx := -velx
end if
should be alone those lines to bounce it off walls