Performance Question - Destroy unused actors?

i002399i002399 Member Posts: 2
edited November -1 in Working with GS (Mac)
I'm working on a few simple prototypes to learn the GS toolkit and wondered if I need to "kill off" all of the spawned actors that drop out of frame that are no longer required.

For example; a waterfall of characters dropping from the sky, approximately 3 per second that a user taps on. after they drop passed the screen they will no longer be used.

Should i add timers and kill the actors?
Set a collision out-of-frame and kill them on impact?

Thoughts?

Sorry if this has been covered, i searched a bit in the forum but am a bit of a newb.

Thanks for any guidance.
Mike

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Mike, you used to have to destroy them out of screen but not now: I learned the other day that anything outside of screen more than 499 pixels get destroyed automatically.

    Don't know if anyone else will confirm that.
  • jb15jb15 Member Posts: 602
    499 pixels might work--but since we're talking about performance, you might as well have them destroyed before then (unless the extra rule is worse for performance).

    In my games I use: If self.x is less than -10, destroy. The actor in this case is 20 pixels high/wide, and I don't want to see them destroyed--I want them to be destroyed when I don't see it. So, that's why -10 (at x -10, a 20 pixel actor is not seen).

    Or, you could say: When self.time is greater than (however long you want it to stay alive) then destroy.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Good thinking, jb15; another way would be as Mike thought, put 4 walls outside the screen, with destroy rules.
  • i002399i002399 Member Posts: 2
    thanks guys. This stuff is pretty fun and extremely simple to do.

    Not to thread-jack my own, but is there a search tool that i'm missing for this forum?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Click on the magnifying icon next to GameSalad at the top of the page. :-)
Sign In or Register to comment.