How do I can i use a random spawn?

0 favourites
  • 10 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hi

    Im not rly good at English so forgive me.

    Im just Learning construct2 to creat a basic video games for a young person. It's a labyrinth where he'll have to get treasure. When he catch one, i'd like it to spawn on another random place (on the player way, not in a wall) but i don't understand how to make it.

    Actually, i just tried to creat 10 sprite wich will be join by the treasure one after one but always in the same order...Just boring!

    Thanks for your help

  • Do you want to spawn them absolutely anywhere in the labyrinth or a list of spawn points would do?

    How are you creating your labyrinth? Is it tile-based? If it is, you can just select a random floor tile and spawn the treasure at its position.

    If you give us a bit more information to work with or a capx, it would help to find the best solution.

  • Hi

    I need a list of spawn because the treasure shouldn't be able to spawn in a wall.

    Yes it is tile-based if you mean i use a grid.

    The spawn even sheet should be based on the treasure and not in a tile isn't it?

  • This could be an option:

    If you have a list you could use the choose() expression to decide what place should be picked

    set variable spawnplace to choose(1,2,3,4,5,6,7,8,9)

    if spawnplace =1 spawn at x=whatever, y=whatever

  • If i understood well, i should creat a sprite in each square named 1,2,3....

    Then i've to add a variable but i don't know where i should write choose(1,2,3..)

    And then i've to set the x and y of each spawnplace

    I just descover the interface so i don't rly know what to use and where. That's a real roblem

  • i also have some trouble with my random spawning system.

    im using this way but it spawns the enemies even in the middle of the layout and in the corners... dunno why

    the result of this code is :

    and yes those pink squares are my spawners

  • burningcake

    Your code makes it possible to spawn at x=spawner1.x y=spawner3.y, so the result is as expected..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • burningcake

    Your code makes it possible to spawn at x=spawner1.x y=spawner3.y, so the result is as expected..

    how to change that then?

  • Well, I wouldn't use spawner1, spawner2 etcetera, but just one spawner sprite..

    system pick random instance spawner - system create enemy at spawner.x, spawner.y

  • Well, I wouldn't use spawner1, spawner2 etcetera, but just one spawner sprite..

    system pick random instance spawner - system create enemy at spawner.x, spawner.y

    i just really dunno what you mean...

    i only can use system-> create object

    nothing with instance

    EDIT : damn i see what you mean thanks!

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