Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a game in AS3, and it's a rather simple shooting game because I'm original. Anyway, probably the most subjective question here yet: what is the best way to implement bullets in my game?

Would it be smarter to make a universal bullet manager class on the game that handles all the bullet related data or have every entity that has bullets (players, enemies) have this sort of 'bullet manager'?

Make a level-wide bullet manager --or-- bullet manager for each entity?

Oh, and a side question: I actually have an enemy manager class. How would I check for collisions from the aforementioned bullet manager class.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can treat your bullets just like other gameobjects in your system. There is no real reason to separate every type of gameobject( there is no need to have managers for everything). Use a clean interface class(not gui) so that you can treat them all the same. For example your interface can contain an update function so all of your gameobjects have an update function that is called in your gameloop.

As for collision detection, you could consider a manager that deals with spacial portioning where your gameobjects are separated into their own spatial bounded groups and only checks collision for the objects that are in that specified coordinate boundaries. When analysing objects for spatial partitioning you can check whether they are even relevant to collision. If not simply ignore them.

You can give your bullets a grouping type/tag. So that you can separate player and enemy bullets during the process of separating your spatial objects. When collision occurs you can send out an event that's caught somewhere where the appropriate action is taken.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.