Forward & Backward Typewriter

0 favourites
  • 4 posts
From the Asset Store
Keyboard, Mouse & Typewriter SFX / 27 Unique Sound Clips
  • CAPX: dropbox.com/s/kax5ocp33oc7wfc/OpPAS%20v2-5.capx

    Look under the HUD event sheet, starting at line 13 under the "Thought" Text comment line.

    I'm wanting to create a typewriter effect for my text, then, after a short delay, delete that text in the same order.

    The

    The Scirra

    The Scirra Bros

    The Scirra Bros are awesome!

    Of course, all that above would be typed out one letter at a time.

    Then, the same message would be deleted one letter at a time in the same way it was typed...

    cirra Bros are awesome!

    s are awesome!

    some!

    The above was shown in time lapse for illustrative purposes. <img src="smileys/smiley17.gif" border="0" align="middle" /> <img src="smileys/smiley2.gif" border="0" align="middle" />

    Thanks to Ashley's example, I can get the typing effect to come out just fine:

    EVENT | Every tick

    ACTION | Add 1 to TextCounter

    SUB-EVENT || TextCounter % 5

    SUB-ACTION || Set text to left(text, TextCounter/5)

    I've made some modifications to this so that it checks when the text in a variable is the same length as the "master text variable" are equal, it moves to the next step. I've included that in my capx.

    It's my figuring that the "deleting" of the text one letter at a time would basically be about the same as the typing. Except that I'd use the right( ) text expression rather than the left. I've encountered a number of issues...every workaround seems to create a new problem.

    My ultimate goal is to have it where certain conditions - the character discovers a new item near by, he's damaged, or detects a hidden passage - will "think" (he's a robot AI) and those thoughts will appear in a text window on the HUD. So the the typewriter effect - writing and deleting -will be a nice touch to sell the theme and the character. It's just getting it to WORK...

    What usually works for me is to break the process up into stages (variable TextProcess)

    TextProcess = 0

    +

    [Condition]

    ==> "Type" text as describe above

    When "master text" variable & "displayed text" variable are equal

    ==> Set TextProcess => 1

    (This is to check when the intended displayed text has fully been typed, since there will be various texts to display at any given time)

    TextProcess = 1

    ==> Wait x seconds (this allows the text to be read by the player)

    ==> Set TextProcess => 2

    TextProcess = 2

    ==> Delete text one letter at a time, left to right, just as it was originally typed

    ==> Set TextProcess = 0

    That's the gist of what I'm trying to do. Hopefully the capx makes a little more sense and you can see what my error is.

    Thank you for your time and your help/suggestions!

  • If I understand what you are after..

    try changing "line" 16 to

    right(DisplayTextCheck,len(DisplayTextCheck)-1)

    ?

  • Here's how I would do it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I actually got it working since posting this - just didn't have a chance to update. But I'll check your capx, :) Thank you.

    RamPackWobble - I actually had something like that set up before, but my problem ended up being with a simple action that I was missing and didn't see it.

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