How do I Add a variable into my text element

Get help using Construct 2

Post » Sat Jul 12, 2014 6:18 am

Hi, For the game im creating i have a money system, i just made a variable called money, What could i put in my text box so that the variable is displayed,
Example:
Cash: 10000

i tried Cash:"variable.money"
it has to be something like that, but i cant put my hand's it, thanks :)
B
3
Posts: 2
Reputation: 175

Post » Sat Jul 12, 2014 7:59 am

You should make an action for the text box object and pick the "set text" action (double click on it). Then choose the variable (I'm guessing that you have a global variable) from the "System object".

eg: (for a variable named variable)

Every tick ----> Text | set Text to variable
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Sat Jul 12, 2014 9:49 am

@jakepugh15

For your specific example, do:
Text->Set text to "Cash: " & money

Anything between " " will be displayed as you typed it.

Use & to join different things together

For global variables, just type the name without quotes e.g. money. For instance variables or object values, type the object name and variable/value separated by a dot e.g. Object.variableName

See the bit on Text (strings) in the manual on Expressions for more info.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,780


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 24 guests