Jump to content
  • Advertisement
Sign in to follow this  
mick8569

C# bullets as list?

This topic is 3849 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 am making a space invaderes type game with xna game studio in C#. Currently Im generating bullets and the monsters via a list to assign their position as a Vector2. Is that the best way to do it? It seems to be a bit messy and hard to access each actual bullet because i think i have to be in the assingment loop. also im unsure of how best to detect for collisions, currently i have the assigning moster position loop inside the bullet loop so that they are both accesible to detect a collision between the two. Is it posible to check for collision between two different monsters doing it this way? I can post code if it will be useful. Thanks for any help, Mick.

Share this post


Link to post
Share on other sites
Advertisement
If you're doing collision detection, then you could do a naive implementation, which checks every object against every other object. For space invaders, this might just be the simplest (not a great many objects on screen). It's complexity is O(n^2), which ain't brilliant, but, like I said, n will be small. Using lists is fine, there are more complex ways of storing stuff (scene graphs, BSP-trees), but for a small project like this, and I'm assuming you're relatively new at this sort of stuff, it's fine.

You can post code if you want.

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!