How do I join a word with an integer variable?

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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!

  • set animation to "page" & speechnumber

    This will result in page1, page2 page(any variable value you have)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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