Multiplification of 2 global variables, how to?

Get help using Construct 2

Post » Thu Mar 08, 2012 10:42 pm

Hey all. I'm from HBgames and new to SC2, so i have a question.

I have a global variable Score and a global variable Multiplier (this is just hardcoded int, 125 for example).

When the players finishes a level, he goes to a new layout (let's call it result) And he get's his final score. This variable finalScore should be "Score * Multiplier". But I can't get this right in C2. Any help?

Thanks!gRaViJa2012-03-08 22:48:07
B
3
Posts: 3
Reputation: 288

Post » Thu Mar 08, 2012 10:48 pm

You can refer to the variable when you set the variable.
So start of layout set score to score*multiplier.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Thu Mar 08, 2012 11:04 pm

Lol, okay. I of course already tried that, but i typed "& score * & multiplier" since i had to type that to display variables in messages too. Just a matter of learning the syntax it seems. So when do i have to use & and when not?
B
3
Posts: 3
Reputation: 288

Post » Thu Mar 08, 2012 11:11 pm

Ampersand is for concatenation of text, so you would just use that with strings. Like your_name_here&", "& score*multiplier.
You can also use + in some cases, but its a bad habit really.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Thu Mar 08, 2012 11:31 pm

Ok, thanks for the info!
B
3
Posts: 3
Reputation: 288


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, badmoodtaylor and 11 guests