How do I maintain object when the layouts change?

0 favourites
  • 12 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • The question is simple: can I maintain the object with the same position when the layouts are changing? Is it possible? Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Store X.Y coordinates in arrays.

    If you do not know what it is, then you need to familiarize yourself with them.

    If I do not understand you, then excuse me.

  • Store X.Y coordinates in arrays.

    If you do not know what it is, then you need to familiarize yourself with them.

    If I do not understand you, then excuse me.

    Thanks for your reply. Could you be more specific, please?

    I want that an object remain the same (at same position) when the layout changes.

  • If you mean that you are going to another layout and returning and you want it to be there in the same place it was before, you can use something called Persist behaviour.

    If you mean staying in the same position and appearing in the next new layout you can give the object global properties, tick global on its settings, and it will remain in the same place and follow through to the next layout.

    What previous person is proposing is that you can store the co-ordinates of the object in an array or a variable and use these later to set the objects position but you will also need to create the object again when changing layout.

  • If you mean that you are going to another layout and returning and you want it to be there in the same place it was before, you can use something called Persist behaviour.

    If you mean staying in the same position and appearing in the next new layout you can give the object global properties, tick global on its settings, and it will remain in the same place and follow through to the next layout.

    What previous person is proposing is that you can store the co-ordinates of the object in an array or a variable and use these later to set the objects position but you will also need to create the object again when changing layout.

    Thanks for your reply lionz, I have already tried to set "Global" on the object but when the layout changes, unfortunately the object disappears. I don't know why.

  • If it is correctly set to global then it would not get destroyed when you leave a layout, it remains and you should see it. Check in debug view in case the object exists but is hidden. It could be an issue where the layers are different. Or if it is not working as expected you would have to share the file to debug it.

  • When you select the barrier objects, on the properties under the name there is a checkbox Global, you need to tick this.

  • When you select the barrier objects, on the properties under the name there is a checkbox Global, you need to tick this.

    lionz After your advice, I selected "Global" on every barrier object but nothing is happened.

  • Not really sure how your game works but you have logic set up to create a new barrier only when you enter the red layout. If you run it in debug mode it does this, you can see it creates a new barrier and the barriers remain through each layout change because they are global. Beyond this I don't know how the game works :)

  • Not really sure how your game works but you have logic set up to create a new barrier only when you enter the red layout. If you run it in debug mode it does this, you can see it creates a new barrier and the barriers remain through each layout change because they are global. Beyond this I don't know how the game works :)

    Thank you, you're right. The problem is "on the start of layout"... How can I replace it?

  • Not really sure how your game works but you have logic set up to create a new barrier only when you enter the red layout. If you run it in debug mode it does this, you can see it creates a new barrier and the barriers remain through each layout change because they are global. Beyond this I don't know how the game works :)

    Can you make all my object barrier global for every layout switch? I can pay you if you can help me... Please

  • If they are global they remain on every layout switch. If you mean create a new one every layout switch then you can take the logic from the red sheet for creating a barrier and add it to the other ones.

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