Spawn a formation?

DookiDooki Member Posts: 247
edited November -1 in Working with GS (Mac)
Hey all,
- I figured out how to click on an actor that will trigger the spawn of another actor, and then be able to move it.
- How can I spawn a formation of say 5 actors? I'd like to be able to have a couple of preset formation buttons that call up formations of actors. Then I can move then around.

Thanks!

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Just add more spawn behaviours.

    If button is pressed
    Spawn actor 1 at x,y (you've already done this bit)

    then add:
    Spawn actor 2 at x,y
    Spawn actor 3 at x,y
    Spawn actor 4 at x,y
    Spawn actor 5 at x,y

    Simplest way.

    Hope that helps,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • DookiDooki Member Posts: 247
    Interesting. I tried this but nothing seemed to happen.

    - Made a rule "is touch is pressed."
    ---Spawn actor.
    ---Spawn actor (offset the X,Y)

    When I previewed I only got the first actor. I will try this again.
  • quantumsheepquantumsheep Member Posts: 8,188
    That's odd.

    I use the method I described to spawn multiple enemies, or multiple bullets from enemies. Don't get why it wouldn't work for you... though I do use a timer to spawn them instead of a button.

    Perhaps you need to have a boolean variable that changes when you press the button. Let's call it 'SpawnOn'.

    Now
    When button is pressed.
    For 1 second: Change SpawnOn to true.

    Otherwise change SpawnOn to false.

    Then have a spawner actor that says:

    IF SpawnOn is true

    Spawn all your actors.

    Try that maybe?

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • DookiDooki Member Posts: 247
    Nope. Got in to the office and tried it again. It works! Thanks.
    One question though. Is there an easy way to specify spawn location? Or is my only option to play with x,y values? For example I want these actors to spawn in a "V" formation.

    Thanks.
    -Dooki
  • quantumsheepquantumsheep Member Posts: 8,188
    I'm guessing that's where arrays would come in...

    I think x,y values are the best way for now. Ready to be proved wrong though! :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.