Remove the letters in a text by order by button press

  • how do I remove the letters in a any text in a spritefont/text by order by button press

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As per your other thread, use mid() again.

  • whoops meant by key press but thanks this makes it easier to understand of sorts

    thanks again blackhornet

  • can you explain this to me ?

    Finish.Text & mid(Start.Text,0,1)


  • mid() has three parameters: text, index, count

    'text' is self explanatory

    'index' is where to start extracting the text from. Computers start counting at zero, so if we put zero here, we start extracting the text from the beginning of the 'text'. If we use 1, then we skip the first character and start extracting from the second character.

    'count' tells us how many characters to extract. So in the first case, mid(Start.Text,0,1), we extract one character from the beginning of the 'text'.

    len() returns the count of the number of characters in the text. So len(Start.Text) returns whatever the current length of the text is at the moment.

    So, mid(Start.Text,1,len(Start.Text)-1) counts the number of characters, and subtracts one, as we want to extract all the characters EXCEPT the first one, so we need one less character than we started with. So starting at index 1, and extracting 1 less that the full length of the text gets us all but the first character.

    Finish.Text=Finish.Text & mid(Start.Text,0,1) takes the current text and adds the first character of the Start text to the end of itself.

    Start.Text=mid(Start.Text,1,len(Start.Text)-1) sets the Start text to itself minus that first character.

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