XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Destroying unused objects or reusing?

Last post 16/04/2009 9:17 by Rizman. 3 replies.
  • 16/04/2009 3:39

    Destroying unused objects or reusing?

    I am creating a Tower Defense game and I have started to create the missiles that will be fired from my towers.  What is the best way to handle these missile objects?  The two methods I have thought of:

    1.  Initialize and create enough missiles that you can use an 'alive' bool to create and reuse these missiles.
    2.  Create a missile each time a bullet is fired and destroy it when it hits its target. 

    Which is the better approach or is there something else I should be considering?  Thanks!
  • 16/04/2009 3:45 In reply to

    Re: Destroying unused objects or reusing?

    If you plan to deploy to XBox then 1. is the recommended techique.
    Game hobbyist hell-bent on coding a diabolical Matrix
  • 16/04/2009 4:19 In reply to

    Re: Destroying unused objects or reusing?

    Okay, thanks, that is exactly what am planning to do so I'll take that approach, I appreciate the fast response :)
  • 16/04/2009 9:17 In reply to

    Re: Destroying unused objects or reusing?

    You should absolutely use number 1).
    Here is a very good blog entry about resource pools which you should really read.
    Advice from the swamp: A generic pool collection class
Page 1 of 1 (4 items) Previous Next