[Solved]...do some advanced typewriter effects

0 favourites
From the Asset Store
Keyboard, Mouse & Typewriter SFX / 27 Unique Sound Clips
  • Hi there,

    I was inquiring yesterday about how to do a basic typewriter effect and I found some great previous solutions on the forum but now as i'm getting into this a little deeper I'm wondering about some deeper stuff.

    I want to have a typewriter sound to go with it. I can trigger a sound with each tick sure, but I can't figure out a way to know when the text typing is complete and thus create a condition to say "this is no longer looping", stop. It seems like there might be some kind of "upon completion" parameter that I could use.

    I could imagine some kind of "typing active" variable that flips off when the last word in the source text is done.

    a more manual (but less efficient) idea would be to actually count how many letters a given source text object has and track it that way.. but that's really tedious with this project which has many pages of varying text. Maybe there is a way to "get letter count" and pass that to a counter var?

    I just don't know how I might be able to set it up so that C2 knows the text is complete and act upon that knowledge.

    Thanks!

    Caleb

  • It sounds from the way you're describing it, the best way would just to just make a comparison between what's in the text object and the source text, and don't play the sound when they equal. Don't get why loops are getting involved though, are you running the typewriter more than once per tick?

  • hmmm wow yea that's a great suggestion. I will try that and report back. i've never done a comparison like that before.

  • I'm interested in your solution if it ends up working. Good luck!

  •    Maybe there is a way to "get letter count" and pass that to a counter var?

    len(text)

    Return the number of characters in text.

  • len(source.text) < len(destintation.text)

    play sound

    add to destination.text

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • typewriter_audio.capx

    Can't remember who made that typewriter example (think it was Ashley)... I just added sound to it.

  • i'm having some trouble getting the value over to where i think it go. i'll explain how i'm doing it:

    I have two global vars

    LetterCount

    LetterTotal

    I have a source text (that works) called S1P1 so i did a global var "set value"

    len(S1P1.Text)

    i have a test text field to display this number.. and i always get 0. what i believe i should be seeing is the number of letters in the S1P1 text.

    i have more stuff after this, but as long as that value reads 0, nothing else will work. Len tells me it wants a string not a number, which is why i am using .Text) in the code above.

    Thanks!

    Caleb

  • shinkan, that does seem to be a good approach.. let me see if i can mimic that logic.

  • shinkan how are you inserting the audio below the other event? my audio fires off beside the set text to left.. so the loop never stops so i just end up with infinite ticking.

  • ok i think i see what i was doing wrong.. i'm not doing any kind of sourcetext.text comparison with destination text..

  • I get it now. that's awesome. so yea the thing i wasn't doing was the inverting (X) in the comparison. Very cool. I'm also doing more than 1 character at a time (10) and it still works nicely!

    Thanks for your help with this!

    Caleb

  • shinkan i use your example because is effective and simple but im wondering how get typewriter effect every time when i change text in source ?

  • delgado In that particular example you need to just change the Source Text and re-trigger the event (button does that here)

    Bare in mind that this not need to be a text object - for source text, it can be a variable, dictionary/array value or any other string.

  • shinkan why you use choose expresion? what if i change text in events?

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