How do I replace letters with a substitute symbol over time?

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • So this is hurting my brain.

    I need to build an answer hint for a word game that draws from an array.

    If I have a 3 word string like: "This is Answer"

    How do I first get it to display as" "**** ** ******" and then every 5 seconds it swaps out a "*" for the original letter like "Thi* ** ******" until eventually it fills in the whole word.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If it was a single word I would probably approach it by grabbing a position in the text using tokenat(text,var,"") where var is a random number between 0 and text.length. Then I would check that this value is not already a * and change it to *, else run the check again. With several words, I guess you expand this into first checking if value at position is equal to "" (a gap) and if so then run the check again. There might be a simpler way to run through it randomly but that would be my approach.

    edit : just noticed your example wasn't randomly filling in but in order so you would add 1 to var every 5 seconds, and set at tokenat(text,var,"") to *. Then when you come across a gap you could set to * if that's relevant to the design of the game, or skip it.

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