How do I set text to value of an instanc variable(type Text)

0 favourites
  • 5 posts
From the Asset Store
Animated Text
$3.99 USD
With AnimatedText behavior you can make an impression of the text being “typed live”.
  • How do I set text of a Text object to value of an instance variable(type Text) of a Sprite?

    I am having a Sprite object with instance variable(type Text) V_name having a value. I am also having a text object in my game. I want to set the text of Text object with the value(string) in V_name. I tried "Set text to Sprite.V_name" and "Set text to str(Sprite.V_name )".

  • set text to ""&sprite.V_name

  • Both Set text to Sprite.V_name and Set text to str(Sprite.V_name) should work.

    If they don't work, maybe a wrong sprite instance gets picked or there is some other issue with your code.

    Run your game in Debug Mode (ctrl-F4) to check how many Sprite instances you have and to see their instance variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • set text to ""&sprite.V_name

    Thank you for the quick response.

  • Both Set text to Sprite.V_name and Set text to str(Sprite.V_name) should work.

    If they don't work, maybe a wrong sprite instance gets picked or there is some other issue with your code.

    Run your game in Debug Mode (ctrl-F4) to check how many Sprite instances you have and to see their instance variables.

    You were right, it was picking wrong instance. Thank you for the quick response

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