How do I delay meteorites falling down from the top and then resetting to a random position?

0 favourites
  • 2 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hello

    Sorry for the 'obvious' questions. I'm just trying to understand how this game engine works.

    I'm creating a space invader like game. I am trying to figure out how to make a meteorite fall from the top of the page, wait 2 seconds, and then another one to fall and repeat like a loop. Once they hit the bottom of the layout then they go back to the top at a random position and repeat continuing the 2 second delay per meteorite falling. So far I've got meteorites falling but they aren't falling from the top. I've basically cloned the same meteorite 10 or so times. They are gliding down but they aren't delayed by 2 seconds and they aren't spawning at the top and resetting when they hit the bottom.

    I do apologize for asking what some would say are simple questions. I've tried google searching answers but they haven't helped. Any help would be greatly appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't need to recycle them, you can destroy and spawn new meteorites.

    Try this code:

    Every 0.5 seconds : Create Asteroid at (random(layoutWidth), -300)
    
    Asteroid compare Y>2000 : Asteroid destroy
    

    .

    If you do need to wait 2 seconds and teleport the same meteorite back to the top of the screen, you can do something like this:

    Asteroid compare Y>2000 : 
     Asteroid set position to (random(layoutWidth), -300)
     Asteroid Bullet set disabled
     Wait 2 seconds
     Asteroid Bullet set enabled
    

    You can check out the game I made some time ago, here is the project file:

    dropbox.com/s/kpyb2c64cgvrzoh/DamagedControlsGame.c3p

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)