How do I: Make Global variable change it's state.

0 favourites
  • 3 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Good evening pals. Im having a problem in my character selection.

    I have two playable characters in game and a Global variable "ActiveCharacter" where i have determined 1 as first character and 2 as second one.

    Here's the event sheet and gif from what happens. So basically it works with mouse but with gamepad it doesn't change from 1 to 2. But if i active the character two with mouse it lets me change back to character one with gamepad.

    Event sheet.

    Gif.

    I remember having similiar problem before but couldnt find the .capx or solution anymore.

  • Let me give you an example why this doesn't work.

    Let's go event by event.

    • You start with ActiveCharacter=1 and ActiveScreen=2
    • You press left on the Gamepad
    • Line 6 triggers and sets ActiveCharacter to 2
    • In the same tick, the event in line 9 triggers since ActiveCharacter is now 2 and sets it back to 1

    To you, this looks like nothing happened.

    The mouse events work since there can only be one mouse event happening at the same time.

    What you need to do, is replace ActiveCharacter=2 in line 8 with "Else".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Let me give you an example why this doesn't work.

    Let's go event by event.

    • You start with ActiveCharacter=1 and ActiveScreen=2
    • You press left on the Gamepad
    • Line 6 triggers and sets ActiveCharacter to 2
    • In the same tick, the event in line 9 triggers since ActiveCharacter is now 2 and sets it back to 1

    To you, this looks like nothing happened.

    The mouse events work since there can only be one mouse event happening at the same time.

    What you need to do, is replace ActiveCharacter=2 in line 8 with "Else".

    Yup. That did it! Thanks alot mate. I found the one .capx where i had this similar problem and the Else-condition did it.

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