HELP! (with spawning obstacles)

SneakySneaky Member Posts: 20
edited January 2018 in Help Wanted

Hi,

I want my game to have 2 different obstacles that spawn. One that spawns at a low Y position, and the other at a higher Y position (for example, obstacle A's Y position is 30, and obstacle B's Y position is 60). Both of these obstacles are moving from right to left (they spawn outside of my game's screen, and they then move towards my character to try and hit him), but that's not really what I need help with.

My issue is that I want those obstacles (the one that spawns at a low Y position, along with the other one that spawns at a higher Y position) to spawn ONE AT A TIME AT RANDOM ORDER, and then move, as planned, from left to right across my game's screen, as they are trying to hit my character. For example, obstacle A could spawn twice, then obstacle B spawns once, then obstacle A spawns once, than obstacle B spawns 4 times, then obstacle A spawns twice, and so on... Please help me with this on how to do it. I just can't figure it out...

Thanks

Comments

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

    @Sneaky said:
    . . . . I want those obstacles // to spawn ONE AT A TIME AT RANDOM ORDER, and then move, as planned, from left to right across my game's screen . . . .

    In your spawner actor, make yourself a new attribute, let's call it "MrPickles".

    Timer - Every 2 seconds

    --Change MrPickles to random (0,1)

    --When MrPickles = 0
    ----Spawn obstacle A
    --Otherwise
    ----Spawn obstacle B

  • SneakySneaky Member Posts: 20

    @Socks

    I just applied what you told me to do, and so far, it works!! Thank you so much!

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

    @Sneaky said:
    @Socks

    I just applied what you told me to do, and so far, it works!! Thank you so much!

    It will only work if you use the attribute name "MrPickles".

    :p

  • SneakySneaky Member Posts: 20

    @Socks

    Hahaha!

Sign In or Register to comment.