Jump to content
  • Advertisement
Sign in to follow this  

what type of collision detection should i use? (2d)

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

Hi I was wondering what the best way to do collision detection in my game is. I want to be able to add new levels into my game very easily (by say a few lines of code just importing the image of the level). I think I should use collision detection based off color, but I am not sure how I should go about it because I also need to know where the collision occurred. I think I came up with a solution, but I'm not sure if it will work yet. The way the collision detection system works is by looping through the pixels underneath the image (that needs to be checked) and checking if they are a certain color. I was thinking I could just put some logic statements in the loop and check for collisions within certain ranges ( say the first 50 pixels would be half of the top row of pixels then the next 50 pixels would be the second half of it). Am I thinking about this correctly or should I go about this a different way? Also I am not exactly sure how to collect pixel data in xna...do i use getData method for type texture2? or what methods do I need to know about? (note: i don't have any code yet I am just planning the game out)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!