How do I spawn random layouts and destroy them?

  • I have an End Less Runner game,

    All events are in main layout, and I have at least 50 more layouts as levels.

    Now I want leyouts come in main layout (random) befor Runner(camera) rich the place and then get distroy after past the camera, then they get back to random list again.

    There must be no delay .

    What can I do ?

  • Is there any way to call layouts come true ( by random) after first layout?

  • Could you not use system choose(layout1,layout2,etc,etc)? then store it and then call it?

  • LI0NHART : I dont realy undestand what do you mean! This is my capx file, maybe It can help!

    https://app.box.com/s/924iazmpg5p58hnenta0[/code:115jflln]
    
    

    shirokuma : Can you help me to do this please?[/p] Also I wana make sprite4 to not jumpable, when player jumped from it, then die!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, so you can't really spawn a layout in another layout, because that's not what layouts are for..

    layouts are like different rooms. You can go from one room to the other, but not create a room within a room.

    You can ofcourse create the objects in your event-sheet placed like you have in the other layout.

  • LittleStain As you can see there is a bunch of cractors in layouts, how can I manage them all in main layout (layout1) by random and keep all caractors in exact place (x,y).

    There has to be a short way to do!

  • My way of doing it, which might still be a bit difficult, would be creating the objects from arrays with a single function.

    It seems your layouts are grid-based, so recreating them inside an array to determine what goes where should be relatively easy.

    Then just call a function to create a layout offscreen based on the grid of a random array..

  • Mazdakfx

    Is this layout change fast enough? Just let the character run. You will see a little blue box. Let the player hit the box.

    I didn't change too much in you code. I'm not certain why some things were done they way that they were, so I didn't want to change things until I understood your code better.

  • shirokuma

    Thanks for your reply.

    This is a test code, so the things are there untill get complete.

    I want the layout change without delay and also by random.

    In your code player just goes to other selective layout and there is also a delay!

  • LittleStain

    Thanks for your reply.

    About using array I have to say this objects are not all objects I wana use in game. There has to be more, so it's realy dificult to use aray and get them point one by one!

  • Not really difficult in my opinion, just use a number for every different kind of object you'd like to create in the array and use the position in the array to determine the place in the grid to spawn the object..

  • Here it is going to random Layouts. I removed everything from the Layouts as any difference between where you leave a layout from where you enter a layout will make it obvious. There is still a flicker in the player, but that could be handled by getting the animation number from the sprite when it leaves a layout and starting it on the the next frame in the next layout.

  • shirokuma

    Excellent job, well done! Thank you.

    As you said just need to check animation frame on collision with exit1 and +1 in next level, correct?

    But How to do that?!

    .

  • Mazdakfx

    Yes, I think the animation starting from 0 as it enters a new layout is causing some of the player flicker. You probably also want to make sure that the player sprite is the same Y value in relation to the floor in each of the layouts.

  • shirokuma

    I did understand about player sprite Y position in each layout. Just don't know how to check animation frame on collision with exit sprite!

    .

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