Jump to content
  • Advertisement
Sign in to follow this  
coolblue

Collision Routine

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

I currently have a game manager class which iterates through all the sprites to check for collisions. I was wondering if this is best practice or if it would be better to let each sprite check for its own collisions?




It is a 2d game if this makes any difference.







Share this post


Link to post
Share on other sites
Advertisement
What is the physics like? What kind of shapes are you testing?

Depending on your needs, you're probably better off switching to an existing physics engine like Box2d.

Share this post


Link to post
Share on other sites

What is the physics like? What kind of shapes are you testing?

Depending on your needs, you're probably better off switching to an existing physics engine like Box2d.




There is only simple physics going on. I just need the sprites to detect if they are on the ground (2d platformer) or touching an enemy etc. obviously a player sprite will behave a bit differently from a bot and also differently to a map object so I was wondering if it would be better to allow the sprite object to handle to collisions for itself or if the sprite manager is the best place to do this (as the sprite will then need to either explode, push and object, fall, or jump etc depending on the type of collision). Currently the sprite has no idea about any other sprites in the game as this information is in the sprite manager class but I can always add a reference to it in the sprite objects. I am just wondering if there are pitfalls to either implementation down the line.


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!