What is the best way to save one layout as I go to another?

0 favourites
  • 6 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • In my game, the player can collect things from the ocean layout and bring them into their lighthouse layout. When leaving the ocean to the lighthouse everything from the ocean layout resets. I have tried using the persist option but everything respawns creating duplicates. I've tried a few different ways with persist and they all have some significant flaws. I have also tried the save/load feature but I feel as though that would create a duplication effect with what is brought to a different layout. How would you go about going back and forth between layouts?

    Another thing I'm unsure of is how to actually bring an object from one layout to another. I have fish in the game that gets textured during play making them unique so I can't spawn a random instance on the other layout. Is there a way to transfer exact instances between layouts?

  • I would advise using the Persist behavior. If you are spawning objects in runtime, you need to do this only once, and don't respawn them when you return to that layout later - Persist behavior will take care of that.

    Another a much more difficult option is to use an array to store the data about objects on each layout.

  • Ok after some trial and error, I believe I have made the persist function work for my game. Thanks for the help! I'm still wondering about the best way to transfer objects from one layout to another. Is there a function I'm missing that makes it easy to do that? I am trying to move the Drawing Canvas object to capture random textures on fish. Also, the player object but I don't think that one is too tough.

  • You can set an object as Global. Then when you switch to another layout, the object will be transferred there automatically. Make sure not to create duplicates!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome. I was hoping it would be that easy, thanks. One thing I just realized I need is to make a layout size larger during gameplay. For example, adding 1000 to the Y direction to make the space larger after upgrading. I can't find a way to do that. Or if I could create layouts during gameplay. I'm trying to make everything in my game infinitely scaleable so this would help a ton.

  • You can't change layout size in runtime. You can allow "Unbounded scrolling" in layout properties.

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