Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

breakout collsion

This topic is 3626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

if(x1>windowWidth-rsize||x1<-windowWidth) xstep=-xstep; if(y1>windowHeight) ystep=-ystep; if(y1<-windowHeight+rsize) ystep=-ystep; x1 += xstep; y1 += ystep; can someone explain this code to me, I need a fresh perspective.

Share this post


Link to post
Share on other sites
Advertisement
... to quote myself from a previous thread:


In the case of breakout the ball is interacting with only vertical and horizontal surfaces. This is a good thing because we can employ a simple trick to calculate the reflected vector.

Lets say the ball's direction vector is <x,y>.

That vector reflected off of a horizontal surface is is <-x, y>
That vector reflected off of a vertical surface is is <x, -y>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!