How do I adjust non-active Layouts, Buttons, and Linking mid-game?

0 favourites
  • 6 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • Sorry, I had no idea how to word that title question. Here's the situation, which I hope makes things clear.

    I have a point and click game that requires entering passwords. I've attached an example of three different layouts below.

    1. Player clicks "Strange Door"-->

    2. Door is Locked, Text Input for Passcode-->

    3. Door is Unlocked (passcode was successful).

    This work's beautifully. However, there is backtracking my game, and as of now, players have to re-enter the passcode each time they move through the door. I'm trying to avoid that. I want Layout 1 to link directly to Layout 3 (and skip Layout 2 completely) once the Layout 2 passcode was entered successfully.

    If you're still reading...thank you! Here's what I've tried so far.

    I've dabbled with "Destroying" the Strange Door button when the code is entered, and creating an identical button that links to Layout 3. I've also tried visible/invisible settings.

    The problem I'm realizing is that because the code is entered on Layout 2, it can't effect a Layout 1 object unless I make that Object Global, but then when it's global it appears and interferes on other Layouts.

    Maybe I'm overlooking something above, maybe I need to learn about behaviors and instances, which I really don't understand, but willing to learn if you point me in the right direction.

    Any help is greatly appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you return to layout 1 are you given the same options but the door is now open? You can give the 'Strange Door' button a variable which changes when the door is unlocked, if var=0 then go to layout 2, if var=1 then go to layout 3.

  • I was going to suggest the same as lionz, but use a global variable instead of an instance variable on the button. The button won't remember its variable when you return to Layout1, unless it's set as global (which I don't recommend here) or has Persist behavior.

    So a global variable would be the easiest choice.

  • When you return to layout 1 are you given the same options but the door is now open? You can give the 'Strange Door' button a variable which changes when the door is unlocked, if var=0 then go to layout 2, if var=1 then go to layout 3.

    Yes, when you return to Layout 1 after entering the code, I want it to be exactly the same as before (same buttons/options and same artwork). The only thing I want to change is the destination of clicking "Strange Door."

    I sort of understand your solution. Let me see if I can figure out how to do that. Using your example, I'd want this variable to be permanently var=1 once the code is entered and never revert back to var=0. Will Construct allow that?

  • Yeah you posted at same time, as mentioned above you can use Persist behaviour which might be good for this type of game, or global variables.

  • Creating Global Variables worked! It's easy! It's beautiful! It's perfect! Thank you both!

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