Custom Counters in HUD? (Purple Coin Challenge)

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
Unknown68D
Koopa Troopa
Koopa Troopa
Posts: 20
Joined: Tue Feb 05, 2019 8:47 pm
Flair: Positivity!
Current Project: My very first SMBX Episode: The Epic Quest!
Chat Username: Unknown68D
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

User avatar
MrDoubleA
Swooper
Swooper
Posts: 103
Joined: Mon Aug 20, 2018 7:02 am
Contact:

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.
Hi. I'm not very active on the forums.
(MrDoubleA#3124 on Discord)

rooms.lua - Quick respawn & Celeste-styled rooms
simpleLayerMovement.lua - For all your custom layer movement needs!
MrDoubleA's NPC Pack
Are you a mouse?
I support: show
Image
Image
Image
Image


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 6 guests