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

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Chilly14
Snifit
Snifit
Posts: 230
Joined: Thu Jul 18, 2019 10:28 pm
Flair: wash your hands and stay at home
Pronouns: he/him

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

Postby Chilly14 » Tue Jan 21, 2020 8:22 pm

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

Murphmario
Chargin' Chuck
Chargin' Chuck
Posts: 2343
Joined: Fri Dec 20, 2013 7:07 pm
Pronouns: he/him

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

Postby Murphmario » Tue Jan 21, 2020 8:25 pm

Maybe just trigger a timer loop, which displays the Course Clear text when it reaches a certain number.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

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

Postby Enjl » 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)

Chilly14
Snifit
Snifit
Posts: 230
Joined: Thu Jul 18, 2019 10:28 pm
Flair: wash your hands and stay at home
Pronouns: he/him

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

Postby Chilly14 » Tue Jan 21, 2020 10:38 pm

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!


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest