How do I highlight non-matching characters when comparing two text strings?

0 favourites
  • 5 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • Hello friends,

    I'm trying to make a typing practice interface for my students. The user is presented with a word, they type it, and, if correct, a new word is served. If incorrect, the wrong characters are highlighted. I know how to do everything except for the highlighting of the wrong characters.

    Here's a barebones project file.

    dropbox.com/s/r3mllpw3g0ji9q8/matchCharacters.c3p

    It doesn't include the highlighting mechanic because my attempts were so totally fruitless that there's nothing worth sharing in that regard. I suspect that I am supposed to use len to compare at every tick and get the wrong characters, but I couldn't get it working despite prolonged attempts.

    Any help is greatly appreciated. Thanks!

  • What if a student types 'bdog' - is this considered as one mistake in the first letter, or 3 mistakes?

    In other words, should the game wait until the correct letter is typed before moving to the next one? Or should it move to the next letter, regardless of whether the right or wrong key was pressed?

  • I can now see that using the "wait until the correct character is typed before moving on" model would probably be dramatically simpler. I think that's also a fine way to go. So if a wrong character is entered, it does appear - but it's red - then a buzzer sounds, and the character flashes and goes away, leaving the user at the previous state, with the insertion point ready.

    I think this must certainly be a far easier approach. It seems like it would also be less confusing to the user. Downside is it will not provide as much learning opportunity to troubleshoot and fix text, via the arrow keys, backspace, etc.

    I think this route is the more sensible choice.

  • I can now see that using the "wait until the correct character is typed before moving on" model would probably be dramatically simpler. I think that's also a fine way to go.

    Yeah, it's the easiest way. I made a demo:

    dropbox.com/s/6y883of0em28v87/TypingGame.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I can now see that using the "wait until the correct character is typed before moving on" model would probably be dramatically simpler. I think that's also a fine way to go.

    Yeah, it's the easiest way. I made a demo:

    https://www.dropbox.com/s/6y883of0em28v87/TypingGame.c3p?dl=0

    I have to say, in addition of course to thank you - that it is sobering when I see the level of expertise that someone like you has, and how far I have to go, but it's also inspiring and motivating. I learn something every time, and having someone who is so skilled and generous with their time helping with these very specific case studies that are so directly relevant to what I'm trying to accomplish with this toolset, I'm just very fortunate, so thanks again.

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