How do I make a checkpoint

  • Hello all

    I am not sure if it is the good title but I will try to describe what I am trying to do.

    Basically I am doing an endless runner game. What I am looking, is to give choice to player to continue the game once he losts one time and continue to collect coins.

    So what I did

    • Create a layer called continue
    • this layer contain the window with buttons (watch a video to continue or pay 100 coins to continue); this layer initial value is invisible
    • create a global variable called continuecheck

    So

    The global variable continuecheck = 0

    When player dies first time and continuecheck = 0 ===> set continuecheck to 1 and set layer to visible

    player has 10 seconds to choose

    Once the countdown get to 0, set continuecheck to 0 and layer invisible and go to game over page

    The problem

    According to what describe, logically the global variable continue check has to be 0 for layout to show.

    So when the game go to game over page, continuecheck is 0 at that time but when the player go back to the game the continue window does not show anymore when he dies.

    I have to close the game and restart for the window to show.

    Did anyone has an idea how to fix or a better way to do that?

    Sorry I hope I am not to confusing for my description

    Thank you for taking the time to read

  • Do you reset continuecheck and countdown timer at the start of the layout/level?

    Try running your game in debug mode (ctrl-F4) and see what's going on with this variable, countdown variable, layer visibility etc.

    If nothing helps, share your capx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello Dop2000

    Thank you so much for your hint.

    Actually the issue was the global variable coutndown which I had to reset to 10 seconds when the layout starts

    Thanks again

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