How do I make text instances appear in an order

0 favourites
  • 5 posts
From the Asset Store
OpenAI TTS
$10 USD
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • Greetings

    I have a text object with 3 instances, UID 0,1 and 2. I would like when I tap the screen to see the text with UID 0, if I tap again I would like to see text with UID 1 as well as keeping 0 visible, and last with UID 2 for another tap, so in the end after 3 taps all instances would be visible.

    I used the following but it didn't work

    Would appreciate help, thanks!

  • I was able to get the effect you want with this setup:

    In this case I setup the TextVisibilityPerPage variable like you did to -1. Event #2 is a touch event that you would tie to your background tile (I have it going on any touch event) which adds 1 to the variable.

    Event #3 is on the text_main object that checks an instance variable called "visibility" against the TextVisibiltyPerPage global variable and if it matches then it sets the visibility of the object.

    To set this up I created three instances of the text_main object on the page and added an instance variable called "visibility" setting it to 0 for the first one, 1 for the second, and 2 for the third. The reason why I used an instance variable is because I couldn't find a way to compare the built-in UID variable of an instance in a condition. Also actions work against the object, not the instance so when you're comparing text_main.UID you're comparing the instance but the action will work against all objects. Or something like that. When I first set it up all three text objects would appear.

    Also this just sets them to visible so you need to deal with setting them to invisible as well.

    As a side effect I found it you add another event where you're comparing "visibility" to be not equal to TextVisibilityPerPage and an action of setting text_main to invisible, it has a toggle effect, each time you tap on the screen the first one appears, then the first one vanishes and the second one appears, then the third. Probably an easier way to do this but it was an interesting discovery.

    Hope that helps.

  • I will try this when I get home, thank you very much.

    One thing I am unsure of though, as I saw the basic tutorial with the guy shooting aliens, the author made so that every alien has 5 hp via instance variables. So if I were to choose 0,1 and 2, wouldn't all 3 text instances have only 1 instance variable value at the end? 2 to be more precise?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It worked out great, thank you very much. Also that side effect you wrote about...it's great .

  • It worked out great, thank you very much. Also that side effect you wrote about...it's great .

    Glad it worked out for you! Sorry, couldn't post a .capx at the time but happy it solved your problem.

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