# How do I make randomly positioned objects drop from above?

Get help using Construct 2

### » Sun Sep 25, 2016 2:31 pm

I'm working on a project with feigned horizontal movement, where the player has to stay airborne while avoiding/dealing with obstacles. I'm wanting things to come in from above the screen somewhat randomly, how would I go about this?
B
8
S
1
Posts: 60
Reputation: 574

### » Sun Sep 25, 2016 3:06 pm

You can set up a series of spawn points above that are used randomly, every x seconds pick random spawn point instance or you can create objects at a random range of X across Y every X seconds. Lots of ways to do it. The objects will need some other logic set up to move down, or you can apply physics behaviour.

So the logic will look something like this:

Every X seconds
Pick random SpawnPoint -- Spawn Obstacle at SpawnPoint

OR

Every X seconds -- Create object Obstacle at X=random(0,1000), Y=0 (co-ords are flexible)
B
52
S
21
G
94
Posts: 2,421
Reputation: 55,530

### » Sun Sep 25, 2016 4:48 pm

plinkie wrote:You can set up a series of spawn points above that are used randomly, every x seconds pick random spawn point instance or you can create objects at a random range of X across Y every X seconds. Lots of ways to do it. The objects will need some other logic set up to move down, or you can apply physics behaviour.

So the logic will look something like this:

Every X seconds
Pick random SpawnPoint -- Spawn Obstacle at SpawnPoint

OR

Every X seconds -- Create object Obstacle at X=random(0,1000), Y=0 (co-ords are flexible)

Thanks much!
B
8
S
1
Posts: 60
Reputation: 574

### » Sun Sep 25, 2016 5:27 pm

Check out the vertical space shooter example that comes with C2 too (when you go to new project), most people miss it.
B
60
S
30
G
133
Posts: 1,943
Reputation: 74,863