• Typewriter Animation Effect?
    3 replies, posted
I am wanting to make a draw.SimpleText that will add a character every delay. Kinda like a typewriter where it will one by one type one then I will add a sound to it. Any way of doing this?
I think, you will understand how to combine this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:timer]timer[/url], [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/PlaySound]surface.PlaySound[/url], [url=https://www.lua.org/pil/3.4.html]Concatenation[/url]
Yeah, but is there a way where I can put the whole text in a table then use a loop to loop through and add a delay to each one?
[code]local text = "This is the message you want to be drawn." local time = CurTime() local pos = 1 hook.Add("HUDPaint", "", function() if (CurTime() > time) then pos = pos + 1 time = CurTime() + 0.3 end draw.DrawText(string.sub(text, 1, pos), "DermaDefault", 100, 100, color_black) end) [/code]
Sorry, you need to Log In to post a reply to this thread.