How to set pieces randomly in the level.

  • Hello everyone.

    I am creating a game vertical infinite runner type game. In this I have created this random set pieces

    file:///C:/Users/Jignesh/Desktop/1.png[/img]

    file:///C:/Users/Jignesh/Desktop/2.png[/img].

    I have created many like this and at start you will spawn at first image and as you move on the second image appear and it is smooth transition and so on it goes. every time it is randomly selected.

    Can anyone help me??

    Thank you.

  • Sorry I actually don't know how to add image,therefore i have put the url to dropbox and you can see the imagehttps://www.dropbox.com/s/e9g2gu71tb48d2g/1.png?dl=0 and

    https://www.dropbox.com/s/4pejwgagdd73de6/2.png?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Create a bunch of events that relate to a variable number, i.e. if 1 then spawn this pattern, if 2 then spawn this pattern. This could be in one event, a function that you pass a variable parameter through. Then every x seconds or whatever timing is required for spawning the next set piece you can use 'choose' i.e. choose (1,2,3,4) or 'random' i.e. random (0,5) to pick a random number which you can then put through the function and spawn the relevant set piece.

  • Thanks plinkie but I need them to scroll down as you move forward. In buildbox you have to create a level as different scene and as you move forward the system automatically select any scene and it looks like random and it is smooth. In the game color switch you can every time new obstacles are spawn I want the same system or mechanism.

    Can you help me.

  • Yes the logic I mentioned will randomise what spawns, although there are many ways to do it and tweak it. Scrolling down as you move forward is a separate thing and easy to do, you could have everything +Y constantly if it is automatically moving or have it so that everything in the level moves down as the player moves up.

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