-
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
-
Easy thing actually, make a UDT for typedtext
Code:
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
Code:
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
-
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 [email protected]
thanks a lot
-
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
Code:
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 :)
Code:
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
-
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
-
ah, not a problem ;)
change this:
Code:
text = Left(.text, pos)
Form1.CurrentX = .Xpos
Form1.CurrentY = .Form1.Print text
to this:
Code:
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.
-
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
-
;) Sure i'll help you whenever i can. kedaman, that's my name ,not my real one, my member name