PDA

Click to See Complete Forum and Search --> : The letterings which appears in RPG


nameJack
Oct 10th, 2000, 05:44 AM
Hello avid game programmers...!

Uh... If you had read my last post, then you should know I'm struggling to make a simple RPG game...
Hope you can help me out in this prob.

How do you make those wording which appears as though they are being type?
If you're an avid RPG game player, then you should notice the way they present the text, coming out letters by letters.
Like mmm... Lufia, Breath of Fire, Tales of Destiny, Suikoden, Final Fantasy Series of course, etc

Well... I search for ways of doing so and I managed to do something similar with a timer
But I'm sure the experts out there have something else besides using the timer...
Please help me out...

Thanx a lot

kedaman
Oct 10th, 2000, 09:08 AM
Easy thing actually, make a UDT for typedtext

Type Typedtext
Text as string
Freq as single
Start as long
Xpos as integer
Ypos as integer
End type

Then have a frequently called function that draws the text to which you pass a Typedtext UDT to render the text, and return true if the text is fully typed

Function DrawTypedText(TT as typedtext) as boolean
Pos=(Gettickcount-Start)/Freq
if Pos>len(Start) then pos=len(start):Drawtypedtext=true
Text=Left(TT.text,Pos)
'move to the position and print the Text with the method you want
End function

nameJack
Oct 12th, 2000, 06:29 AM
Thanks immensely
but can you give me an example coz i tried the examples you've shown...
however, it didn't work much
so...
my email is benyeoh@tm.net.my
thanks a lot

kedaman
Oct 12th, 2000, 07:31 AM
Ok sorry i didn't have vb last time so i couldn't test my code. Now this example should work.
Place this in a module

Declare Function GetTickCount Lib "kernel32" () As Long

Type Typedtext
text As String
Freq As Single
Start As Long
Xpos As Integer
Ypos As Integer
End Type

Function DrawTypedText(TT As Typedtext) As Boolean
Dim pos As Long
With TT
pos = (GetTickCount - .Start) * .Freq / 1000
If pos > Len(.text) Then pos = Len(.text): DrawTypedText = True
If pos > 0 Then
text = Left(.text, pos)
Form1.CurrentX = .Xpos
Form1.CurrentY = .Ypos
Form1.Print text
End If
End With
End Function

And this on a form with a command buton, try change the values and see what happens :)

Private Sub Command1_Click()
Dim example As Typedtext
With example
.Freq = 10
.Start = GetTickCount + 500
.text = "THIS IS EXAMPLE TEXT"
.Xpos = 500
.Ypos = 500
End With
Do
DoEvents
Loop Until DrawTypedText(example)

End Sub

nameJack
Oct 13th, 2000, 01:26 AM
WOW!!!
Thanks a lot!!!
It work just nice...!
One last questions though...
Can you make something similar in a label or textbox rather than specifying the text to appear on certain position on the form...
It's kinda troublesome...

Anyway, thanks a lot

Regards

kedaman
Oct 13th, 2000, 04:20 AM
ah, not a problem ;)
change this:

text = Left(.text, pos)
Form1.CurrentX = .Xpos
Form1.CurrentY = .Form1.Print text

to this:

text = Left(.text, pos)
label1=text

remember, if you want you could set the label to autoresize while you do this, and it will take the size while typing, but if you want to keep the multilines, then don't.

nameJack
Oct 13th, 2000, 10:20 AM
Thank!!!
You're certainly an expert!
I guess that's it...
Thanks a lot
Please help me next time, will you?
Btw, what is kedaman?

Regards

kedaman
Oct 13th, 2000, 10:52 AM
;) Sure i'll help you whenever i can. kedaman, that's my name ,not my real one, my member name