Custom Counters in HUD? (Purple Coin Challenge)

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Unknown68D
Bob-Omb
Bob-Omb
Posts: 24
Joined: Tue Feb 05, 2019 8:47 pm
Flair: Mindfulness
Pronouns: he/him
Contact:

Custom Counters in HUD? (Purple Coin Challenge)

Postby Unknown68D » Thu Jul 09, 2020 7:25 pm

Hello! One of the levels in my episode makes use of collecting 100 purple coins to reveal a star after they are all collected. It works fine in its current state using the "No More Objects in Layer" event. However, I was wondering if it would be possible to implement a custom counter in the HUD specific to this level. It would work along the lines of this: If an NPC is collected (Death Event), increase the counter in the HUD by 1. In addition, are there any good images that would represent purple coins similar to how the count counter has a yellow coin image beside it? Thank you!
Image

MrDoubleA
Flurry
Flurry
Posts: 351
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: Custom Counters in HUD? (Purple Coin Challenge)

Postby MrDoubleA » Sat Jul 11, 2020 5:11 pm

If you want any custom HUD element, you can do this:

Code: Select all

local function myHUDElement(camIdx,priority,isSplit)
    -- Do stuff here
end

Graphics.addHUDElement(myHUDElement)
... or, if you want to override the HUD entirely, you can do this:

Code: Select all

local function myCustomHUD(camIdx,priority,isSplit)
    -- Do stuff here
end

Graphics.overrideHUD(myCustomHUD)
-- (or Graphics.overrideOverworldHUD for the overworld)
I'll send you the code for the purple coin counter through discord shortly.


Return to “LunaLua Help”

Who is online

Users browsing this forum: cato and 2 guests