0 Favourites

Checkpoint Mystery

  • In an attempt to save me the hassle of having several different stage checkpoint objects, I decided to have a system that relies on a global variable and a variable that changes depending on the checkpoint area triggered.

    For example, if one were to enter a room with a checkpoint with the variable number 15, it would set the "stagearea" global value to that number. This part seems to work fine. However, when restarting a stage after dying, the game, for whatever reason, decides to either pick the starting point of the level or the very LAST checkpoint in the stage.

    (The "scrollding" variable isn't important in this)

    Is there something wrong with the way I set up these events, or is this just simply not possible to do?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Nothing is impossible. ;)

    What I can tell from your screenshot looks fine to me.

    The problem probably lies in the way you "restart" the stage.

    Are you restarting the layout?

    Or are you scrolling to a specific point in the layout?

    Because when restarting, the stagearea variable should be set to the stage's checkpoint number, correct?

    If your current game isn't too big, a .capx would be very helpful too.

    Also, adding a "Trigger once while true" to the last condition in your screenshot would be good too.

    (It probably doesn't solve the problem, but it's a nice habit to add it to conditions that don't have to trigger every tick)

  • Nothing is impossible.

    What I can tell from your screenshot looks fine to me.

    The problem probably lies in the way you "restart" the stage.

    Are you restarting the layout?

    Or are you scrolling to a specific point in the layout?

    Because when restarting, the stagearea variable should be set to the stage's checkpoint number, correct?

    If your current game isn't too big, a .capx would be very helpful too.

    Also, adding a "Trigger once while true" to the last condition in your screenshot would be good too.

    (It probably doesn't solve the problem, but it's a nice habit to add it to conditions that don't have to trigger every tick)

    Restarting the stage involves resetting the layout, yes. If I add a check to make sure it doesn't get change the "stagearea" variable until the level intro sequence begins, the global variable remains the same throughout until the level actually begins.

    If I were to send you this, I'd probably have to cut out a lot of stuff, so I'll just send over a video to show what's wrong. This is with the "for each" event cut out, so it happens a bit differently than I described in the video.

  • Okay, without the .capx, this will be a bit more difficult. But I understand that your project is quite big already and cutting it properly will take long.

    Anyways, as I said, debugging from the distance is quite hard.

    So let's start some tests.

    • Did you try not restarting the layout on death, but instead scrolling to the start point?
    • Do you have any other events that set "stagearea"?
    • You probably already looked at "stagearea" in the debug view right? If you didn't yet, go ahead and see how and whether it changes when entering rooms
    • Try adding "Trigger once while true" to the last condition in your screenshot. Just to make sure, this isn't what causes the problem

    That's about everything I can think of now without looking at the .capx.

  • Through some sort of magic and fiddling around, I've somehow managed to fix it. Thanks for the help.

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