How to spawn in a prepositioned set of blocks?

  • Hello!

    I'd like to spawn in a random set that has prepositioned blocks. So if this infinite 'runner' game's first set's Y is at a certain height, it will spawn in a new random set at the top. The screen/sets will move downwards.

    Do I make functions or can tilemaps even do something here? I suppose I will have to do some forehand positioning in C2?

    I'm not sure where to start and was wondering what good approaches are.

    Thanks!

  • This is how I often do this - I add sets of objects somewhere off-screen on the layout. Each set is in a yellow block:

    Then on start of the layout I generate level by picking a random block and adding all objects from it:

    I'm using a family "Objects" with just one member "Object" to simplify picking, but you can do this in a different way - by calling a function for example.

    After that I delete all original object instances and blocks.

    If you game is an infinite runner, generating a very long level in advance is probably not a good idea. You can use the same method to add blocks as players progress through the level.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your reply.

    Looking at your example; I will have to let my brain do over time to incorporate it into my own project. Also, after an extra reality check, I will have to put this project on hold as its scope is beyond what I want my next game to be.

    In any case, thanks for your example, I copied it and saved it for future reference.

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