Compare value is not working

0 favourites
  • 2 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi, i am trying to make an action that when I click a button, if that button has the same value as the value stored in a global variable it should go to another layout, but this is not working, any ideas why this is happening?

    (Sorry if my english is not perfect, it is not my foreign language. )

  • Try Construct 3

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

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

    at start of layout you are changing the value of the global variable, but since there are probably multiple buttons, it is getting a value other than what you are looking for.

    if you move that action to event 2, it should work. (set the global variable button to button.action in the "On Left button Clicked" event, then the sub event will work - when you click on the button that has "action" set to selectCharacter)

    another way to do it without a global variable would be to store the layout to go to in the "action" instance variable, (set button.action to "pjCreation")

    then in event 2 add an action that says: system > Go to button.action

    (then you dont need the sub event, or other sub events for other layouts).

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