I want the text to show in self-writing, like in Pokemon, Undertale, or any other game, but I have no idea of how to use the string functions to make it.
example:
texto = "hello"
"h"
"he"
"hel"
"hell"
"hello"
how can I do it?
Best Answer XeduR @Spyric , 26 November 2018 - 12:57 AM
You just need to make a slight adjustment. I would also recommend that you assign custom anchorX and Y to the text so that it functions like in those other games you mentioned.
s = [[this is a multiline texto en lua]] local tam = string.len(s) local cantidad = 0 local displayed = display.newText("", 100, 100) displayed.anchorX = 0 displayed.anchorY = 0 timer.performWithDelay(50, function() cantidad = cantidad+1 displayed.text = s:sub(1,cantidad) end, tam)
I want the text to show in self-writing, like in Pokemon, Undertale, or any other game, but I have no idea of how to use the string functions to make it.
example:
texto = "hello"
"h"
"he"
"hel"
"hell"
"hello"
how can I do it?
Best Answer
You just need to make a slight adjustment. I would also recommend that you assign custom anchorX and Y to the text so that it functions like in those other games you mentioned.
s = [[this is a multiline texto en lua]] local tam = string.len(s) local cantidad = 0 local displayed = display.newText("", 100, 100) displayed.anchorX = 0 displayed.anchorY = 0 timer.performWithDelay(50, function() cantidad = cantidad+1 displayed.text = s:sub(1,cantidad) end, tam)
Corona →
Corona APIs →
Audio and Graphics →
Performance tip #193: Preload your fontsStarted by XeduR @Spyric , Yesterday, 04:47 AM ![]() |
|
[GLOBAL: userSmallPhoto]
![]()
|
||
Corona →
General Questions/Discussion →
VS CodeStarted by horacebury , 22 Jan 2019 ![]() |
|
[GLOBAL: userSmallPhoto]
![]()
|
||
Getting Started →
Newbie Questions →
physics.addBody() error !Started by kenny.ng , 18 Jan 2019 ![]() |
|
[GLOBAL: userSmallPhoto]
![]()
|
||
Corona →
General Questions/Discussion →
Pass parameters to active webviewStarted by alg , 11 Jan 2019 ![]() |
|
[GLOBAL: userSmallPhoto]
![]()
|
||
Corona →
General Questions/Discussion →
Match several (mutually exclusive) alternatives with string.find()?Started by Divergent Monkey , 02 Jan 2019 ![]() |
|
[GLOBAL: userSmallPhoto]
![]()
|