Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to bounce a ball (oval) off a wall
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
pat1084




PostPosted: 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
Sponsor
sponsor
saltpro15




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: