Jump to content
  • Advertisement
Sign in to follow this  
AspiringDev

Breakout clone collision detection

This topic is 1407 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

How can I fix the mess that are the check_collision and check_brick_collision methods ? Maybe a good way to fuse them together that in addition will allow me to detect if the collision happened at the sides of a brick so I can change the xVelocity to negative too. Here is the GitHub link of the ball class that contains the said above methods.

Edited by AspiringDev

Share this post


Link to post
Share on other sites
Advertisement

Well, your "check_brick_collision()" returns true...but it doesn't tell you which brick you collided with.  So, you need a way to return that a collision occurred and which brick it hit so you can remove it from the tiles.

 

Also, you're checking every tile, but some tiles will be destroyed, how will you handle that?  Some tiles need to be marked dead or something like that.

 

Finally, if you want to check collisions on certain sides, the simplest method is to move the ball along the X-axis, and then check collision.  If it happens, you know you hit it on the side, and can invert the x velocity.  Then move along the y-axis and do the same thing.

 

Good luck.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!