credits.lua [v1] - simple credits display!

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 542
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

credits.lua [v1] - simple credits display!

Postby Marioman2007 » Tue Jun 10, 2025 5:28 am

A simple script to show credits.
You can use textplus tags.

Showcase:
Spoiler: show
Image

Example Codes:
Some basic actions which can be done by the script, make sure to load credits.lua first.
Spoiler: show
Starting the credits when an event "playCredits" is triggered:

Code: Select all

function onEvent(n)
    if n == "playCredits" then
        credits.play()
    end
end
Loading a level when the credits have ended:

Code: Select all

function onDraw()
    if credits.hasEnded() then
        Graphics.drawScreen{color = Color.black, priority = 100}
        Level.load(Level.filename())
    end
end

Download:
https://drive.google.com/file/d/1d_dYFb ... sp=sharing

super merio odysey
2025 Egg Hunter
2025 Egg Hunter
Posts: 371
Joined: Thu Jul 25, 2024 5:34 am
Flair: Deltarune CH3 ending is so mindblowing smh
Pronouns: i identify as sand

Re: credits.lua [v1] - simple credits display!

Postby super merio odysey » Tue Jun 10, 2025 8:24 am

W script im using this

RadMetalMarioSMIX
Buster Beetle
Buster Beetle
Posts: 85
Joined: Sat Mar 14, 2015 6:42 pm
Flair: What kind of grave is this?
Pronouns: he/him

Re: credits.lua [v1] - simple credits display!

Postby RadMetalMarioSMIX » Mon Jun 16, 2025 4:57 pm

Does this deactivate the Pause Menu? Yours and the normal one?

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 542
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: credits.lua [v1] - simple credits display!

Postby Marioman2007 » Tue Jun 17, 2025 1:00 am

RadMetalMarioSMIX wrote:
Mon Jun 16, 2025 4:57 pm
Does this deactivate the Pause Menu? Yours and the normal one?

It pauses the game, so you cannot open the pause menu.

RadMetalMarioSMIX
Buster Beetle
Buster Beetle
Posts: 85
Joined: Sat Mar 14, 2015 6:42 pm
Flair: What kind of grave is this?
Pronouns: he/him

Re: credits.lua [v1] - simple credits display!

Postby RadMetalMarioSMIX » Wed Jun 18, 2025 5:56 pm

Marioman2007 wrote:
Tue Jun 17, 2025 1:00 am
RadMetalMarioSMIX wrote:
Mon Jun 16, 2025 4:57 pm
Does this deactivate the Pause Menu? Yours and the normal one?

It pauses the game, so you cannot open the pause menu.
Okay cool!

super merio odysey
2025 Egg Hunter
2025 Egg Hunter
Posts: 371
Joined: Thu Jul 25, 2024 5:34 am
Flair: Deltarune CH3 ending is so mindblowing smh
Pronouns: i identify as sand

Re: credits.lua [v1] - simple credits display!

Postby super merio odysey » Sun Jun 22, 2025 12:08 pm

Image

when i use this, the moment the credits finally stop, this appears. Here's my level lua code (im pretty sure i did everything correctly)

Code: Select all

local credits = require("credits")

function onEvent(n)
    if n == "playCredits" then
        credits.play()
    end
end

function onDraw()
    if credits.hasEnded() then
        Graphics.drawScreen{color = Color.black, priority = 100}
        Level.load(Level.filename(Outro.lvlx))
    end
end
Here's my global luna.lua file

Code: Select all

local customPause = require("customPause")
local warpTransition = require("warpTransition")
local minHUD = require("minHUD")
local credits = require("credits")
local rankSystem = require("rankSystem")

local levels = {
	{"!DesertDazzle.lvlx",26000,8000}, 
	{"!DistantDistrict.lvlx",48500,9000}, 
	{"!APerilousClimb.lvlx",29000,10000}, 
	{"!CleftyMountainrange.lvlx",26000,9000}, 
	{"!PumpingPlasmaCave.lvlx",10000,13500}, 
        {"!NightlyFrolics.lvlx",9000,18500}, 
        {"!AboveTheClouds.lvlx",9000,18500}, 
        {"!VolatileAircraft.lvlx",9000,18500},
}

for i = 1, #levels do
	rankSystem.registerLevel(
		levels[i][1], -- registers the levelname per level
		levels[i][2], -- registers the requirement per level
		levels[i][3] -- registers the time preset per level
	)
end

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 542
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: credits.lua [v1] - simple credits display!

Postby Marioman2007 » Sun Jun 22, 2025 12:46 pm

Retro wrote:
Sun Jun 22, 2025 12:08 pm

Code: Select all

function onDraw()
    if credits.hasEnded() then
        Graphics.drawScreen{color = Color.black, priority = 100}
        Level.load(Level.filename(Outro.lvlx))
    end
end

Level file name must be a string, so you need: Level.load("Outro.lvlx")

super merio odysey
2025 Egg Hunter
2025 Egg Hunter
Posts: 371
Joined: Thu Jul 25, 2024 5:34 am
Flair: Deltarune CH3 ending is so mindblowing smh
Pronouns: i identify as sand

Re: credits.lua [v1] - simple credits display!

Postby super merio odysey » Sun Jun 22, 2025 1:23 pm

Marioman2007 wrote:
Sun Jun 22, 2025 12:46 pm
Retro wrote:
Sun Jun 22, 2025 12:08 pm

Code: Select all

function onDraw()
    if credits.hasEnded() then
        Graphics.drawScreen{color = Color.black, priority = 100}
        Level.load(Level.filename(Outro.lvlx))
    end
end

Level file name must be a string, so you need: Level.load("Outro.lvlx")
Image

fixed that but now it causes another error:

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 542
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: credits.lua [v1] - simple credits display!

Postby Marioman2007 » Sun Jun 22, 2025 9:59 pm

Retro wrote:
Sun Jun 22, 2025 1:23 pm
Image

fixed that but now it causes another error:
What does the current code look like?

super merio odysey
2025 Egg Hunter
2025 Egg Hunter
Posts: 371
Joined: Thu Jul 25, 2024 5:34 am
Flair: Deltarune CH3 ending is so mindblowing smh
Pronouns: i identify as sand

Re: credits.lua [v1] - simple credits display!

Postby super merio odysey » Mon Jun 23, 2025 2:59 am

Marioman2007 wrote:
Sun Jun 22, 2025 9:59 pm
Retro wrote:
Sun Jun 22, 2025 1:23 pm
Image

fixed that but now it causes another error:
What does the current code look like?
exactly the same thing except that i actually put strings on

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 542
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: credits.lua [v1] - simple credits display!

Postby Marioman2007 » Mon Jun 23, 2025 9:09 am

Retro wrote:
Mon Jun 23, 2025 2:59 am
exactly the same thing except that i actually put strings on

you likely did something wrong, this code works fine for me:

Code: Select all

local credits = require("credits")

function onEvent(n)
    if n == "playCredits" then
        credits.play()
    end
end

function onDraw()
    if credits.hasEnded() then
        Graphics.drawScreen{color = Color.black, priority = 100}
        Level.load("Outro.lvlx")
    end
end

super merio odysey
2025 Egg Hunter
2025 Egg Hunter
Posts: 371
Joined: Thu Jul 25, 2024 5:34 am
Flair: Deltarune CH3 ending is so mindblowing smh
Pronouns: i identify as sand

Re: credits.lua [v1] - simple credits display!

Postby super merio odysey » Mon Jun 23, 2025 3:51 pm

i fixed it, but now when it transports me to a black area in the level (i put the spawn on and it wont change)

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 542
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: credits.lua [v1] - simple credits display!

Postby Marioman2007 » Mon Jun 23, 2025 9:17 pm

Retro wrote:
Mon Jun 23, 2025 3:51 pm
i fixed it, but now when it transports me to a black area in the level (i put the spawn on and it wont change)

Probably an issue with your level, because the level loading also works fine for me.


Return to “LunaLua”

Who is online

Users browsing this forum: Insignicial and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari