Spawn & move actor

wannadudewannadude Member Posts: 3
edited March 2014 in Working with GS (Mac)
How do i spawn a actor every 5 seconds and let the spawned actor move to the right?
And then how do i let the spawned actor disappear outside of the screen? (When it was moved to the right)

Thanks.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Spawner actor
    Timer every 5 seconds
         Spawn actor [actor name]

    Spawned actor
    Move [direction: 0] [speed: 100 or 200 or whatever]

    The actor will automatically "disappear" when it moves beyond the screen boundary. If you want, you can add a rule to destroy it when its self.position.x value is greater than the scene width.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • wannadudewannadude Member Posts: 3
    Spawner actor
    Timer every 5 seconds
         Spawn actor [actor name]

    Spawned actor
    Move [direction: 0] [speed: 100 or 200 or whatever]

    The actor will automatically "disappear" when it moves beyond the screen boundary. If you want, you can add a rule to destroy it when its self.position.x value is greater than the scene width.

    thanks mate, but can i let this happen after a few seconds? so they got time to prepare??
    And also the problem right now is that they only spawn if i have already an actor in game?




  • ArmellineArmelline Member, PRO Posts: 5,370
    Your spawner actor will need to be placed in the scene before you run the game.

    If you want to spawn the actor and then have it wait a few seconds and then have it more, just add a timer to the spawned actor, set to "AFTER x seconds" and put the move behaviour inside it.
  • wannadudewannadude Member Posts: 3
    Your spawner actor will need to be placed in the scene before you run the game.

    If you want to spawn the actor and then have it wait a few seconds and then have it more, just add a timer to the spawned actor, set to "AFTER x seconds" and put the move behaviour inside it.
    I want the first actor to come 2 seconds later, so not first an actor and then 4 sec before the next one. And can i let the actor's come in a random order you now? Now i got it like every 2 seconds. But i wanna make stages (For example: Stage 1 every 2 sec, Stage 2 every 1 sec, Stage 3 random [So 0.5 sec, 1 sec, 0.3 sec, 2 sec]) I hope you get it :D

  • ImNiklasImNiklas Member Posts: 103
    Create a new integer attribute (I call it game.y) and set it to 2 as standard. Then use the following:

    Rule:
    If Attribute game.y >= 1

    Do:
    Timer Every game.y seconds
    Spawn Actor x
    Change Attribute game.y to game.y-1

    Else:
    Timer Every random(0.1,2) seconds
    Spawn Actor x
Sign In or Register to comment.