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.

Moderator: Userbase Moderators

Chilly14
Snifit
Snifit
Posts: 236
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
2025 Egg Hunter
2025 Egg Hunter
Posts: 2389
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.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9891
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

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

Postby Emral » 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: 236
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 30 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari