How do I only show 1 letter from the text object?

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I have a text object with a 5 letter word. The word is generated randomly out of a group of words.

    When the player presses hint, I want to show the last letter of that randomly chosen word.

    Is there away to do that?

    The only way I can think of is to shorten and expand the text object, but that won't work because letters like W are wider than I. There has to be away to do a count and then pick the last letter out of the letter count.

    Am I close?

    Thank you.

  • I would recommend you to look at the systems expressions, they really have useful stuff.

    What you are looking for is right(word,1)

    this would give you the last character of a string.

    If you put another number instead of 1, it would give you the right most X characters of the string, This would be useful if you want to give more hints later on.

    You could just set a text object to that to show the hint, hope this helps!

  • there are other expression like:

    left(text, count)

    for getting letters from the left

    mid(text, index, count)

    for getting characters from somewhere starting in the middle, in this case count can be negative or positive depending which direction you want to receive the characters.

  • Fedca nailed it (He is faster than me)

    This Video will walk you through if you need some extra guidance:

    youtu.be/_uCTRtoxT_k

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • fedca, I've been wondering what 'systems expressions' where called - I will Google that - I've been calling it 'the Math' Thank you!!

    winstreak

    Thank you. I'll watch it now.

  • winstreak,

    You Are My New Favorite Person!!

    Thank you so much for making a video for me.

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