#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# HELP! (with spawning obstacles)

Posts: 8Member
edited January 9

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

• London, UK.Posts: 12,821Member

@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

• Posts: 8Member

@Socks

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

• London, UK.Posts: 12,821Member

@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".

• Posts: 8Member

@Socks

Hahaha!