Typing Effect

BlitzMax Forums/BlitzMax Beginners Area/Typing Effect

Ked(Posted 2008) [#1]
Is there a way to implement a "typing" effect when displaying text? Maybe like the lyrics to "Still Alive" that are shown when you beat Portal?

Thanks!


Dreamora(Posted 2008) [#2]
You mean the visual end? I think for that, even a code archives entry exists.


Ked(Posted 2008) [#3]
I converted the BB version of TypeRiter Text from the code archives to BMX and it doesn't work correctly. I would also like to give the x and y location of the text to be "typed."


Dreamora(Posted 2008) [#4]
Converted means that you took the code and rewrote it?
Import BB is pointless in that case if you wanted to really use the code.

And giving an X, Y location should be a simple change, shouldn't it?

you can post the code here if you want and I take a look


Ked(Posted 2008) [#5]
I converted the BB version of TypeRiter Text from the code archives to BMX

Sorry, I meant I imported it.

I would try and make my own but I am unsure on how to do it. With Blitz3D, since there wasn't any console windows, I used:
Function Rite(a$)
	num=Len(a$)
	For i=1 To num
		Write Mid$(a$,i,1)
		Delay 100
	Next
	Print
End Function
but I don't have Blitz3D anymore. That code also doesn't support x,y.


Dreamora(Posted 2008) [#6]
Well you can not write into the console if you want to have a position.
In BM you use the Text Command which has X, Y if you want a position. This needs graphics window.


Ked(Posted 2008) [#7]
Well you can not write into the console if you want to have a position.

Yes, I know. I used that code with Blitz3D because a console window didn't come up when you used Print because Blitz3D doesn't support console windows.

In BM you use the Text Command which has X, Y if you want a position. This needs graphics window.

Yes, I know. But I need a way to achieve the "typing" effect.

I have a feeling I'm not making myself clear? :/


jhocking(Posted 2008) [#8]
All you've done to explain the effect you want is to put it in quotes, so no you aren't being very clear.


Ked(Posted 2008) [#9]
Alright then.

I want a typing effect that supports x,y position. I want it in BlitzMax. I want it to resemble this: YOUTUBE VIDEO


Dreamora(Posted 2008) [#10]
And where is the problem?

Thats just the text command but with an alternating char at the end, known as "_" :-)
The alternation is handled by measuring time differences.

If you want multiple lines, use an array of string to store them and apply the _ to the line with the highest index at the end when printing.


Ked(Posted 2008) [#11]
And where is the problem?

I don't know how to do it.

...with an alternating char at the end, known as "_" :-)

Thanks for clearing that up.

I do not want the underscore. I just want the text to be typed on to the screen given the x and y location.


Big&(Posted 2008) [#12]
Is this what you wanted?

Graphics(640,480)

Function TeleType(text:String,x:Int,y:Int)
	For Local i:Int=1 To Len(text)
		DrawText(Left(text,i),x,y)
		Delay(60)
		Flip
	Next
EndFunction

TeleType("This is a test",0,0)
Teletype("Please press Any Key to Exit.",0,12)

Teletype("Oh, by the way, the cake is a lie :)",0,48)

WaitKey()
End



Ked(Posted 2008) [#13]
Yes! Thanks Big&.


Xerra(Posted 2008) [#14]
Oh my god! I'm not going to bother playing all the way through Portal now. This guy has given away what happens at the end :-)


Emmett(Posted 2008) [#15]
@Big&: Thanks for this text processing function.

Problem: Last character of each line blinks until all lines are done.
Solution: End all lines with a "space".
Problem: When routine is done, the last character in line one dissappears.
Solution: End all lines with a "space".

Question: Is the following syntax just an alternate method?
Graphics(640,480) and Delay(60)
I've never used parantheses around these numbers before.


Ked(Posted 2008) [#16]
Answer: I don't think it matters if you do use or don't use parentheses.