How do I override a global variable for one of 7 layouts?

  • Heyyyyy it's me again! :D

    So I found this amazing advice on the forums that was almost perfect for what I needed- set a global variable and name it "Last_Layout", and then on the start of every layout, have the system update that layout to be "Last_Layout" so that when the player hits the button that's supposed to take them back to where they were, it will. Here's the problem:

    It's a global variable.

    So. If I've got a separate layout for a save screen and an inventory, which I do, and they are working perfectly otherwise, which they are, is there a way to use separate event sheets for those that are still included with the main event sheet but that override the command to update those to layouts to "Last_Layout"?

    Does that even make sense?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • UPDATE:

    I created individual event sheets, so that at the start of each of those layouts, the "Last_Layout" variable could be changed to the name of the specific layout. I purposely left that command off of my inventory and save screen layouts. So then, I went into my inventory event sheet and put in

    Keyboard - on X pressed go to layout "LayoutName"

    Last_Layout = "LayoutName"

    so when I'm in LayoutName and press X, it takes me to inventory layout, no problem. But once I get to the inventory layout and press X, it doesn't do anything at all. I've even tried changing it to a different input key to see if that's the issue.

  • Annnnd never mind! I set an automatic save status to the current layout on the player pressing X to go to inventory. Then when the player presses X to return to that specific layout, I set it to load that save. It seems to work perfectly. Thank you all for letting for allowing me to work through my insanity in a public forum, hahahaha.

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