Hey i'm making a game and I need something. After you step on a certain brick a little message will appear saying: Hello and welcome to the world! I don't want to it to just appear though, I want it to appear letter by letter if that makes sense.
Like for example the letters will show up like this only it wont appear in rows it will happen all in 1 row. I don't want to have to add a letter every time so if you know an easy way to do this please tell me! W We Wel Welc Welco etc. i want it efficient though
message.Text=W message.Text=We message.Text=wel message.Text=welc message.Text=welco message.Text=welcom message.Text=welcome
Let's say we have a finished string message
. If we want to build the version of it growing one letter at a time, there's essentially two approaches that are very similar:
i
th characteri
charactersThey look like this:
Growing:
text = "" for i = 1, #message do text = text .. message:sub(i,i) print(text) end
Substring:
for i = 1, #message do text = message:sub(1,i) print(text) end
I find the second approach to be much more elegant.