Page 1 of 1

How do I get text to appear as the player clears a level?

Posted: Tue Jan 21, 2020 8:22 pm
by Chilly14
I'm making an episode, and I want the words "COURSE CLEAR!" whenever the player clears a level. However, I used events with LUA and the text displays, but for only a frame:
Spoiler: show
Image
Is there a way I can have it stay until the level cuts to black?
Code:
Spoiler: show

Code: Select all

function onEvent(event)
	if event == "cleared" then
		Text.print("COURSE CLEAR!",20,100)
	end
end

Re: How do I get text to appear as the player clears a level?

Posted: Tue Jan 21, 2020 8:25 pm
by Murphmario
Maybe just trigger a timer loop, which displays the Course Clear text when it reaches a certain number.

Re: How do I get text to appear as the player clears a level?

Posted: Tue Jan 21, 2020 10:33 pm
by Emral
just set a boolean in onEvent that enables relevant code in onDraw. onEvent runs like the name implies: Only on frames that have triggered an event.
Instead of using onEvent you could also just check for Level.winState() > 0 https://wohlsoft.ru/pgewiki/Level_(class)

Re: How do I get text to appear as the player clears a level?

Posted: Tue Jan 21, 2020 10:38 pm
by Chilly14
Enjl wrote:
Tue Jan 21, 2020 10:33 pm
just set a boolean in onEvent that enables relevant code in onDraw. onEvent runs like the name implies: Only on frames that have triggered an event.
Instead of using onEvent you could also just check for Level.winState() > 0 https://wohlsoft.ru/pgewiki/Level_(class)
It worked, thank you!