0

I am creating a side scroller game, and I want a counter on the UI that counts how many times the player has died. But, I do not know what to add to what I have already. I tried typing the variable name behind the &, but it did not accept that. What do I do to put a variable in a set of text?

enter image description here

I am using the free version.

The Man
  • 149
  • 3
  • 14

2 Answers2

3

The & is the string concatenation operator in Construct 2.

For global variables:

"Deaths: " & VARIABLE_NAME

For instance variables:

"Deaths: " & instanceName.variableName

Note the " around the string.

NB: There is no need to explicitly convert the number to a string, it will be done implicitly.

BanksySan
  • 27,362
  • 33
  • 117
  • 216
-2

Construct-2 runs on Javascript, so would the "+" operator not do what you are attempting?

Gijs
  • 84
  • 10
  • I switched it to +, and then put the variable after it, but Construct 2 told me that there is no expression or variable with that name in this scope. I am wondering if I need to relocate my variable to somewhere else instead of an instance varaible under the Text properties. – The Man Feb 19 '15 at 18:14
  • Construct 2 produces JavaScript, it doesn't run on it. – BanksySan Mar 04 '15 at 18:08