How do you make actors spawn repeatedly based on the last actors spawn?

maxmal107maxmal107 Member, PRO Posts: 9
edited November 2015 in Working with GS (Mac)

I am making a game and I'm trying to make platforms spawn repeatedly in a position based on where the last platform spawned...for example: a platform is spawned at x: 100, y: 100 and i want another to spawn at a random position based on where the last one was spawned (example: +200 x, +10 y), and then another to spawn based on where the last one was spawned (at random), and on and on and on....kind of confusing....but I tried so many rule and timer combinations and couldn't get anything to work...anyone got any ideas?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2015

    Have the platform write its location to two game attributes (let's call them PX and PY).

    When you spawn the next platform use:
    Location X = PX + random(range)
    Location Y = PY + random(range)

    . . . so each time a platform is spawned it will update PX and PY, and then the spawner bases its next spawn on these values.

  • maxmal107maxmal107 Member, PRO Posts: 9

    @Socks said:

    Have the platform write its location to two game attributes (let's call them PX and PY).

    When you spawn the next platform use:
    Location X = PX + random(range)
    Location Y = PY + random(range)

    . . . so each time a platform is spawned it will update PX and PY, and then the spawner bases its next spawn on these values.

    It didn't work for me....Did i do it wrong?
    i did this:
    every second
    spawn platform
    Location X = platform position X + random(210,315)
    Location Y = platform position Y + random(0,100)

    what did i do wrong in it?

  • SocksSocks London, UK.Member Posts: 12,822

    @maxmalasky said:
    i did this:
    every second
    spawn platform
    Location X = platform position X + random(210,315)
    Location Y = platform position Y + random(0,100)

    Can you grab a screenshot of the rules you are using ?

  • maxmal107maxmal107 Member, PRO Posts: 9
    edited November 2015

    @Socks said:

    @maxmalasky said:
    i did this:
    every second
    spawn platform
    Location X = platform position X + random(210,315)
    Location Y = platform position Y + random(0,100)

    Can you grab a screenshot of the rules you are using ?

    The name of my platform is "other ground" and i wanted to spawn the first one at x=8800

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2015

    @maxmalasky said:

    I can't tell a lot from that as you've kept some of the elements hidden . . . .

  • maxmal107maxmal107 Member, PRO Posts: 9

    @Socks said:

    @maxmalasky said:

    I can't tell a lot from that as you've kept some of the elements hidden . . . .

    Thanks
    And sorry about that, here's the rest of the info....

  • SocksSocks London, UK.Member Posts: 12,822

    @maxmalasky said:

    From what I can tell, this doesn't seem to be the solution I suggested above.

  • maxmal107maxmal107 Member, PRO Posts: 9

    @Socks said:

    @maxmalasky said:

    From what I can tell, this doesn't seem to be the solution I suggested above.

    For the solution you said above, can you please explain that in more detail because i don't fully understand...

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2015

    @maxmal107 said:
    For the solution you said above, can you please explain that in more detail because i don't fully understand...

    My assumptions are you have an actor that spawns platforms (the spawner) and an actor for the platform (the platform).

    Make two game attributes, let's call them PX and PY.

    Have the platform actor write its location to these two game attributes, so the platform actor should have two change attribute actions . .

    Change PX to self X . . . and
    Change PY to self Y

    Then when you spawn the next platform the location values in the spawn behaviour in the Spawner actor should say . . .
    Location X = PX + random(range)
    Location Y = PY + random(range)

    Hope that makes more sense !

  • maxmal107maxmal107 Member, PRO Posts: 9

    @Socks said:

    @maxmal107 said:
    For the solution you said above, can you please explain that in more detail because i don't fully understand...

    My assumptions are you have an actor that spawns platforms (the spawner) and an actor for the platform (the platform).

    Make two game attributes, let's call them PX and PY.

    Have the platform actor write its location to these two game attributes, so the platform actor should have two change attribute actions . .

    Change PX to self X . . . and
    Change PY to self Y

    The when you spawn the next platform the location values in the spawn behaviour in the Spawner actor should say . . .
    Location X = PX + random(range)
    Location Y = PY + random(range)

    Hope that makes more sense !

    Thanks, and yes that makes more sense, but it is still not working...the platforms are not spawning at all...

  • SocksSocks London, UK.Member Posts: 12,822

    @maxmal107 said:
    Thanks, and yes that makes more sense, but it is still not working...the platforms are not spawning at all...

    Ok.

  • maxmal107maxmal107 Member, PRO Posts: 9

    @Socks said:

    @maxmal107 said:
    Thanks, and yes that makes more sense, but it is still not working...the platforms are not spawning at all...

    Ok.

    So how could I get them to spawn? I did exactly what you said...

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2015

    @maxmal107 said:

    @Socks said:

    @maxmal107 said:
    Thanks, and yes that makes more sense, but it is still not working...the platforms are not spawning at all...

    Ok.

    So how could I get them to spawn? I did exactly what you said...

    Can you post an updated screenshot of the rules you are using ?

Sign In or Register to comment.