Saving from another layout

0 favourites
  • 2 posts
From the Asset Store
Match the similar cards with each other and free all animals!
  • Problem Description

    Loading game from game slot doesn't work.

    Attach a Capx

    https://www.dropbox.com/s/he70fvr0cbbp6 ... .capx?dl=0

    Description of Capx

    Layout1 - Starting layout

    Layout2 - Save game layout

    The starting layout is layout1. It has a single save game button that takes you to layout2. The text objects are hidden and will show up accordingly if the game either successfully loaded or failed to load.

    Layout2 aka save game layout has a button to save the game to a slot named 'slot1'. The load button loads 'slot1'. Since Construct 2 only saves the layout currently in use, saving works by writing global number 'saveslot' to 1 and loading Layout1. Layout1 sheet then saves the game to 'slot1' if 'saveslot' is 1, resets the number back to zero and writes 1 to 'saved' global number which works as a failsafe and then gets back to Layout2. Back in Layout2, the 'saved' number is read and if 1, it assumes the save is successful and prints out "Did the saving work? 1" or alternatively "Did the saving work? 0" in the layout.

    It does work this far.

    Loading is made in the same sense. Global number 'loadslot' is used and checked in the first layout to load the game. Global number 'loaded' works as a failsafe.

    Steps to Reproduce Bug

    • Step 1: In Layout1, click 'save game'
    • Step 2: Click 'save to slot1'
    • Step 3: Click 'load from slot1'

    Observed Result

    Loading save slot flicks to Layout1 and then back to Layout2. "Did the saving work?" says 1, after saving, meaning it should've saved in the slot. "Did the loading work?" says 0, meaning the game didn't even read the sheet before throwing back to Layout2.

    Expected Result

    Layout1 should've successfully loaded from the save slot, with the text "LOAD SUCCESSFUL!" visible.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES
    • Edge: YES

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    Release 239

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the problem is you use "save game" and "go to layout" in the same event. "Save game" can take a few ticks to complete - it's not done until the "on save complete" triggers. But you change the layout before then. I assume you are intending to save the state for the current layout then go somewhere else, but you're probably actually switching layout before the save happens, therefore saving the wrong layout.

    Closing as likely a mistake in the events. If you can still reproduce a problem when ensuring saves complete before changing layout, then please file a new issue.

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