State machines?

  • Hello everyone, i am wondering how to achieve a state machine with Construct 3?

    For example when i press pause i want the background to stop scrolling and some elements disappear do i have to do this manually or is it a way to create a state machine where i just change the states?

    Tried an global variable with isPlaying= true or false but that didnt work. Maybe call an group or something like that?

    Hoping you understand what i am after=)?

    /Isak

  • With Global Variable, the value is not limit in 2 values true & false.

    I usually have the Global Variable gameState.

    gameState = 0 > Playing game

    gameState = 1 > Win

    gameState = -1 > Lose

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • With Global Variable, the value is not limit in 2 values true & false.

    I usually have the Global Variable gameState.

    gameState = 0 > Playing game

    gameState = 1 > Win

    gameState = -1 > Lose

    Thanks for the answer!

    Does the condition:

    System - Check variable execute every frame? So i can just use that condition and when execute some actions? and then just change that variable to make it instant change?

    /Isak

  • Yes, you can use System > Trigger Once While True

  • Okey but does that condition really work? Trigger once while true only trigger once dosent it? i want it to be able to trigger several times if the user pause and unpauses. Or is it just in that frame it triggers once?

  • yes, it'll work.

    You group all play game events in 1 gamestate 0.

    All events pause in gameState 9999

    So when you set gameState to 9999, all events inside gameState 0 will stop.

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