Page 1 of 1

gone sorry

Posted: Sat Nov 23, 2019 3:12 pm
by SPEEDIE
gone sorry

Re: REQUEST: Death Counter (simple)

Posted: Sat Nov 23, 2019 3:20 pm
by Cedur
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

Re: REQUEST: Death Counter (simple)

Posted: Sat Nov 23, 2019 4:44 pm
by Hoeloe
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

Re: REQUEST: Death Counter (simple)

Posted: Sat Nov 23, 2019 5:41 pm
by SPEEDIE
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!