How to spawn actors, and do it without eating up memory.

littlemanappslittlemanapps Member Posts: 13
edited November -1 in Tech Support
Hi,
I have an attribute which goes up every time a coin is collected. and then when it reaches a multiple of 5 to place a enemy actor on the screen, but i've heard using the spawn actor uses up memory.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    place the enemies in the game but off screen, maybe above the gameplay area. when your attribute reaches 5, just MOVE them into the game.

    but then again, if you are only doing limited spawning, you can get away with it fine.

    check out my first game ever:
    http://itunes.apple.com/us/app/z-is-for-zombie-lite/id346479833?mt=8

    it's got a ton of spawning, and was made with an old version of GS, so it's even less memory friendly.
  • littlemanappslittlemanapps Member Posts: 13
    ok thanks, so when it reaches five do i have to set the attribute back to zero or is there another way to keep it counting because i was hoping to use the same attribute for for many coins collected. Thanks and i will check out your app!
  • LumpAppsLumpApps Member Posts: 2,881
    You can make 2 counters 1 that resets after 5 and one that keeps counting.

    As long as there isn't any smooth movement involved on the stage spawning could be used.
    In my Penny Shoel app I have pucks coming from outside the stage because when I would use spawn you would see the moving pucks falter. Now it falters less ;)

    Penny Shoel is here and free so check it out if you like to see it.
    http://itunes.apple.com/app/penny-shoel/id429448038?mt=8
    (v.1.1 is waiting for review now, that version has better performance)
Sign In or Register to comment.