Recycle actors rather than spawning?

GamersRejoiceGamersRejoice Member Posts: 817
edited November -1 in Working with GS (Mac)
Currently, my game allows you to spawn actors at the top of the screen and they fall down with accelerate. Right now it's just spawning as many actors as you press but I figure it may improve performance to just reuse like 15 actors over and over. I've looked all over the forums and I haven't been able to figure this out. Could I get some help on this one?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    it will improve performance greatly, expecially with as many actors as your spawning. Have them all ofscreen at the top, use attributes to trigger the acceleration so they fall down, then when they hit the bottom ( when self position is = or greater then) change the attribute your using to trigger the accelerat to 0 to stop the moment, and change self position to whatever( top of screen)
  • GamersRejoiceGamersRejoice Member Posts: 817
    Cool, thanks John!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Anytime, Happy New Year!
  • GamersRejoiceGamersRejoice Member Posts: 817
    Happy New Year!

    Ok so I got that to work only one problem, now it drops all of my actors at once rather than one at a time.
  • XilombieGamesXilombieGames Member Posts: 6
    Create an integer attribute called spawn and leave it at zero.
    Next, add the following to any actor:
    'When Mouse button is down
    .change attribute game.spawn to game.spawn+1'
    Then, add something like 'when attribute game.spawn = 1
    .Accelerate' for your first actor and 'when attribute game.spawn = 2
    .Accelerate' for your second actor and so on. Then add
    'When attribute game.spawn = 16
    .Change attribute game.spawn to 1' to any of your actors
    Well, that's one way and this is the only way I know of but i'm a noob so yeah.
  • XilombieGamesXilombieGames Member Posts: 6
    Create an integer attribute called spawn and leave it at zero.
    Next, add the following to any actor:
    'When Mouse button is down
    .change attribute game.spawn to game.spawn+1'
    Then, add something like 'when attribute game.spawn = 1
    .Accelerate' for your first actor and 'when attribute game.spawn = 2
    .Accelerate' for your second actor and so on. Then add
    'When attribute game.spawn = 16
    .Change attribute game.spawn to 1' to any of your actors
    Well, that's one way and this is the only way I know of but i'm a noob so yeah.
Sign In or Register to comment.