Page 1 of 1

credits.lua [v1] - simple credits display!

Posted: Tue Jun 10, 2025 5:28 am
by Marioman2007
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

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

Posted: Tue Jun 10, 2025 8:24 am
by ilovehamburgerz
W script im using this

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

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

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

Posted: Tue Jun 17, 2025 1:00 am
by Marioman2007
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.

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

Posted: Wed Jun 18, 2025 5:56 pm
by RadMetalMarioSMIX
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!

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

Posted: Sun Jun 22, 2025 12:08 pm
by ilovehamburgerz
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

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

Posted: Sun Jun 22, 2025 12:46 pm
by Marioman2007
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")

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

Posted: Sun Jun 22, 2025 1:23 pm
by ilovehamburgerz
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:

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

Posted: Sun Jun 22, 2025 9:59 pm
by Marioman2007
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?

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

Posted: Mon Jun 23, 2025 2:59 am
by ilovehamburgerz
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

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

Posted: Mon Jun 23, 2025 9:09 am
by Marioman2007
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

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

Posted: Mon Jun 23, 2025 3:51 pm
by ilovehamburgerz
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)

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

Posted: Mon Jun 23, 2025 9:17 pm
by Marioman2007
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.