Forward & Backward Typewriter

Get help using Construct 2

Post » Thu Jan 23, 2014 12:47 am

CAPX: https://www.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.

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!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
135
S
22
G
8
Posts: 770
Reputation: 14,689

Post » Thu Jan 23, 2014 8:57 am

If I understand what you are after..

try changing "line" 16 to

right(DisplayTextCheck,len(DisplayTextCheck)-1)

?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Thu Jan 23, 2014 4:17 pm

Here's how I would do it.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Fri Jan 24, 2014 4:29 am

I actually got it working since posting this - just didn't have a chance to update. But I'll check your capx, @squiddster. :) 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.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
135
S
22
G
8
Posts: 770
Reputation: 14,689


Return to How do I....?

Who is online

Users browsing this forum: FlyingRam and 9 guests