How do I join a word with an integer variable?

Get help using Construct 2

Post » Sat Mar 01, 2014 6:24 pm

Okay, so I'm a bit new to Construct 2, and I was wondering if there was a way you could join a string to an integer variable in the name of the animation.
Here's basically what I'm trying to do:
I have an integer variable called "speechnumber" which I use to control which dialogue box appears on the screen when characters speak. I also have a sprite which holds all the frames I want to display in the form of specific animations.
Is there a way that, instead of having to write...
System speechnumber = 1 set to animation "page1"
System Else
System speechnumber = 2 set to animation "page2"

...and so on and so forth, I could join the word "page" to speechnumber? And if so, what would I input into the "set animation" dialogue box to do so?
(the page numbers and speechnumbers do coordinate- speechnumber = 1 is supposed to bring up page1 and so on)
Thanks!
B
9
S
3
Posts: 22
Reputation: 755

Post » Sat Mar 01, 2014 6:27 pm

set animation to "page" & speechnumber

This will result in page1, page2 page(any variable value you have)
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Sat Mar 01, 2014 6:32 pm

Thanks so much! I know the syntax to do this kind of thing in C, but I wasn't sure how to do it in Construct 2!
I'll go try it now :)

Update: Thanks again! It works great now :D
B
9
S
3
Posts: 22
Reputation: 755


Return to How do I....?

Who is online

Users browsing this forum: MassimoF, Microbex, Yahoo [Bot] and 24 guests