View Single Post
Old 11-08-2012, 12:28 AM   PM User | #29
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Here's a hint: The "bounce" code is here:
Code:
if ( x==0 || x==xmax || y==0 || y==ymax ) 
{ 
    bug.xspeed = - bug.xspeed; 
    bug.yspeed = - bug.yspeed; 
}
Clearly, to do what you want, you need to keep the two kinds of bounces separate.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote