gone sorry

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

SPEEDIE
Flurry
Flurry
Posts: 180
Joined: Sat Nov 03, 2018 6:22 pm
Flair: u fucking wot
Pronouns: he/him
Contact:

gone sorry

Postby SPEEDIE » Sat Nov 23, 2019 3:12 pm

gone sorry
Last edited by SPEEDIE on Fri Nov 05, 2021 3:57 pm, edited 1 time in total.

Cedur
Link
Link
Posts: 7073
Joined: Tue Jun 28, 2016 10:14 am
Flair: I'm gone, for chess and minesweeper
Pronouns: he/him

Re: REQUEST: Death Counter (simple)

Postby Cedur » Sat Nov 23, 2019 3:20 pm

The "Demo" counter that you see on many of raocow's or Mechdragon's videos is a death counter. (occurs in MaGLX2 for example)

It even differs between total deaths and deaths within the ongoing level

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: REQUEST: Death Counter (simple)

Postby Hoeloe » Sat Nov 23, 2019 4:44 pm

You can do this with a few lines of code in a luna.lua file put in your episode folder.
--Initialise the death counter to 0 if it hasn't been already
SaveData.deathcounter = SaveData.deathcounter or 0

--Draw the death counter at x = 700, y = 20, and at priority 5
function onDraw()
Text.printWP(SaveData.deathcounter, 700, 20, 5)
end

--When the level ends, check if the player is dying, and if they are, add one to the death counter
function onExitLevel() then
if not isOverworld and player:mem(0x13C, FIELD_BOOL) then
SaveData.deathcounter = SaveData.deathcounter + 1
end
end

SPEEDIE
Flurry
Flurry
Posts: 180
Joined: Sat Nov 03, 2018 6:22 pm
Flair: u fucking wot
Pronouns: he/him
Contact:

Re: REQUEST: Death Counter (simple)

Postby SPEEDIE » Sat Nov 23, 2019 5:41 pm

Hoeloe wrote:
Sat Nov 23, 2019 4:44 pm
You can do this with a few lines of code in a luna.lua file put in your episode folder.
--Initialise the death counter to 0 if it hasn't been already
SaveData.deathcounter = SaveData.deathcounter or 0

--Draw the death counter at x = 700, y = 20, and at priority 5
function onDraw()
Text.printWP(SaveData.deathcounter, 700, 20, 5)
end

--When the level ends, check if the player is dying, and if they are, add one to the death counter
function onExitLevel() then
if not isOverworld and player:mem(0x13C, FIELD_BOOL) then
SaveData.deathcounter = SaveData.deathcounter + 1
end
end
Thanks! This worked!


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari