0 Favourites

How do I make randomly positioned objects drop from above?

  • 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?

  • 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)

  • 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!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Check out the vertical space shooter example that comes with C2 too (when you go to new project), most people miss it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,515
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,840
minhcuong's avatar
minhcuong
Unread hot topic
99 10,155
karshinkoff's avatar
karshinkoff