How to make a Button appear in Layout1 only if the player collides with an object in Layout2.

0 favourites
From the Asset Store
Players follower. use it for anything which follows the player
  • How to make a button appear at the "Main Menu Layout" if the player collides with the checkpoint (or any object) in "Stage 1 Layout".

    Why I need this?

    I don't want to make the "continue button" visible on the main menu of the game when the user plays the game for the first time.

    What I did so far.

    1. Unchecked the "Continue Button" initial visibility (From Main Menu Layout).

    2. In "Stage 1 Layout" I placed an object called "X". (a vertical thin line from bottom to top)

    3. In the event sheet of "Main Menu Layout" I put an event when the player collides with the "X" object

    the continue button should visible.

    4. Made Layout 1&2 global also made the object and the continue button global.

    5. Included the event sheet of "Stage 1 Layout" to the "Main Menu Layout"s event page and vice-versa.

    Or is there any workaround for the same?

    (Having said that I have implemented a simple checkpoint throughout the game using built-in save & load action.)

  • A better way of doing it is based on something happening set a global variable to 1. If global variable is 1, set continue button to visible.

    The something happening could be, colliding with that object, entering layout 2, or a save file is present.

  • Thanks for your input I finally made it.

    One little help, How can I save it with local storage? When I restart the game the continue button won't stay.

    It would be appreciated if you provide the "exact events" which need to be placed as I stated with this engine with no prior knowledge of programming.

  • I can come back with something but firstly do you need local storage because you mentioned saving the state of the game with system save/load. This can work well for checkpoints. If it has to be local storage then what kind of things are you trying to save for the player?

  • Yes, I already used the Save/Load state for the checkpoint purpose (Placed an object called "CPointObject" at STAGE1 if Player collides with "CPointObject" A "SAVESTATE1" will create and in the MainMenu placed a text called "Continue" if the user clicks the continue button the "SAVESTATE1" will load) and it worked pretty well.

    My query is the continue button.

    Question. "I don't want to make the "continue button" to visible on the main menu of the game when the user plays the game for the first time."

    Answer. And the solution for that you gave using the global variable, the player need to collide an object in Stage1 then add +1 to the Global Variable, then in MainMenu, make a condition if "Global variable > 0" then the continue button should visible in the MainMenu and it worked pretty well.

    So, what the issue?

    The issue is when I close the game (in android) and then reopen, the continue button again disappear, in order to make it appear The player have to collide the same object once again so that it would appear in the MainMenu.

    , Please help.

    Thanks.

  • Yep got it. You could try something like :

    On start of layout (first one you enter) and global variable=0 (see below) : load slot "save"

    On load failed : do nothing (it means the slot doesn't exist and player never saved)

    On load complete and global variable=0 (see below) : go to the starting layout, set a global variable to 1

    You say if global variable is 1, set continue button enabled

    Then you have your continue button enabled if a load happened (player has a save game)

    Then you have logic : on continue button selected, load slot "save"

    Try that. Note the global variable will be 0 every time you launch the app stopping any loop happening when you tap the continue button.

  • Thanks for your input but sadly I couldn't able to crack it yet. I have made the c3p.

    drive.google.com/open

    Please check this out.

    Thanks.

  • I was just guessing most of that while I wasn't at a computer. Now I looked at localstorage here is the fix : dropbox.com/s/awl15829go5bhpl/localstoragesave.c3p

  • Finally, because of you, along due query has been solved. Thank you very much.

  • I was just guessing most of that while I wasn't at a computer. Now I looked at local storage here is the fix: dropbox.com/s/awl15829go5bhpl/localstoragesave.c3p

    When we click the continue button (from the menu) it would lead us directly to the respected stage and place where we saved our game using checkpoint, my question is can we insert a layout between Continue button and the checkpoint state?

    For Eg.

    When the player clicks the continue button (from the menu), firstly it will show a layout (where I can put some game tips) then it will lead to the exact save state.

    Can it possible?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, the Continue button logic loads the saveslot. You can change it to load a layout instead, then load the saveslot.

  • Yes, the Continue button logic loads the saveslot. You can change it to load a layout instead, then load the saveslot.

    I have a total of 10 stages and each stage having different loading layout (where I put tips etc)

    If the player saved the checkpoint from Stage 6 and then When he click the Continue button from home screen

    First, it should show the loading layout of the stage (here, in this case, Stage 6 loading screen) and then load the last saved state.

    Sorry if it sounds lame.

  • Please help me on this.

    https://www.construct.net/en/forum/construct-3/general-discussion-7/random-frame-start-layout-146121

  • You might have to use local storage to save a global variable (current level) as you save the game. Then you could do something like load global variable from storage, based on the number show the loading screen for that level, and then load the checkpoint/game from saveslot.

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