Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualMorphex

Posted 21 December 2012 - 01:01 PM

Well, my best bet is a simple one, and it has no performance hit whatsoever. Also everything would work as you have it right now.Well almost everything.

Create a base component class, that only has a method called Destroy/Dispose whatever you wish.

Then on your sprite class have a list of these components, when you add one it goes into this list, once you destroy the sprite, just call the Dispose/Destroy method from the interface, and each component would clean up after itself.
You get all of the good qualities from your original method, without any performance hit (well minus the inheritance, but you would just call it when you destroy the sprite)

If you need a more detailed explanation I can throw some pseudo code to you. =)

#1Morphex

Posted 21 December 2012 - 01:00 PM

Well, my best bet is a simple one, and it has no performance hit, everything would work as you have it.

 

Create a base component class, that only has a method called Destroy/Dispose whatever you wish.

 

Then on your sprite class have a list of these components, when you add one it goes into this list, once you destroy the sprite, just call the Dispose/Destroy method from the interface, and each component would clean up after itself. 

You get all of the good qualities from your original method, without any performance hit (well minus the inheritance, but you would just call it when you destroy the sprite)

 

If you need a more detailed explanation I can throw some pseudo code to you. =)


PARTNERS