Storing Value from different buttons

0 favourites
  • 5 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi everyone, I need your help.

    Here's my problem. I'm making a math game where the player has to press some buttons to reach certain predetermined score. For example:

    ? + ? = 7            -----> text

    [1] [2] [3] [4] [5]   ---->buttons

    the number in bracket is the button, and each has the corresponding score to number. Let's say if i press 4 and then 3, the score first obtained should go to the first "?" and the second should go to the second "?".

    Can anyone help me to do this? Thanks

  • You can add Instance Variable to each button to store the numbers.

    In your eventsheet you can access them for example:

    ButtonA : on clicked => TextA : set text = ""&ButtonA.yourVarName

  • You can add Instance Variable to each button to store the numbers.

    In your eventsheet you can access them for example:

    ButtonA : on clicked => TextA : set text = ""&ButtonA.yourVarName

    Thanks I did use variables, but the problem is how to make the text shows the value of each variable in sequence. So if i press ButtonA and then ButtonC the text will show in sequence ButtonA.yourVarName+ButtonC.yourVarName.

    But if i press ButtonCand then ButtonA the text will show in sequence ButtonC.yourVarName+ButtonA.yourVarName.

    The var of the first pressed button shows first and then the sceond and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • <img src="http://world-inventors.com/sequence.png" border="0">

    Here an example .capx http://tinyurl.com/bpt8p5o

  • Thanks That's great. It works and is Exactly what I wanted. <img src="smileys/smiley32.gif" border="0" align="middle" />

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