How do I randomly spawn objects on other objects?

0 favourites
  • 6 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • It's pretty easy to spawn objects randomly inside the window.

    However, I want to spawn objects only on the ground on various platforms (side scroller).

    Should I place invisible boxes on various places that they can spawn in? How would I go about doing that?

    Black are platforms and green is where I want to spawn enemies:

    https://www.dropbox.com/s/r15woy48zsrih2t/Untitled-1.jpg?dl=0

  • The image isn't displayed.

    To "spawn" sprites like the way you describe, I like to use this method.

    I create a square sprite that is invisible or covered by the sprite it spawned by "setting the position to object" and spawn an enemy or a bonus. I use that so you can set a random time or a random object to spawn via a global variable.

    The "difficulty" would be to set a specific mouvement from your sprite. But maybe with the photo it will be clearer.

  • figured it out. i have an invisible object (spawnobj) and invisible spawnmarker. i have the spawn object move every second at random locations. when it finally moves over the spawn marker, it spawns the enemy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I use that line:

    Let say you have a spawner and multiple enemies. Add a variable to those enemies and pick a value for them, I called it Enemychoice here.

    It's just in order to make your spawner choose randomly between multiple ennemies.

    {_System// Every random(X1,X2) seconds---------------------Spawner01// set Enemychoice to choose 1,2,3

    {_Spawner01//Enemychoice=1--------------------------Spawner01// Spawn E1 on layerA(image point0)

    _Spawner01//Enemychoice (different as(the symbol isn't on my keybord))0------------------------Spawner01//set Enemychoice to 0

    _System//trigger once.

    {_Spawner01//Enemychoice=2--------------------------Spawner01// Spawn E2 on layerA(image point0)

    _Spawner01//Enemychoice (different as(the symbol isn't on my keybord)) 0------------------------Spawner01//set Enemychoice to 0

    _System//trigger once.

    {_Spawner01//Enemychoice=3--------------------------Spawner01// Spawn E3 on layerA(image point0)

    _Spawner01//Enemychoice (different as(the symbol isn't on my keybord))0------------------------Spawner01//set Enemychoice to 0

    _System//trigger once.

  • Thank you!

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