minTimer.lua - Mini game timer from superstar saga! [v1]

Share and discuss custom LunaLua code and content packs for SMBX2.
Marioman2007
Buster Beetle
Buster Beetle
Posts: 401
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

minTimer.lua - Mini game timer from superstar saga! [v1]

Postby Marioman2007 » Thu Nov 17, 2022 9:23 am

Another lib I did when I got bored

GIF
Spoiler: show
Image

Credits
Me
Enjl

Download
https://drive.google.com/file/d/1gLskpp ... sp=sharing

Documentation in luna.lua file, check the top of the lib for other settings.
Usage example included.

Enjoy and please give credits!

AirShip
Panser
Panser
Posts: 1036
Joined: Wed Jan 01, 2014 1:30 am
Flair: The Flying Ghost
Contact:

Re: minTimer.lua - Mini game timer from superstar saga! [v1]

Postby AirShip » Thu Nov 17, 2022 10:14 am

I had made a script similar to this one for my episode, good to know that now there is an optimized and less complicated version to use, good job.

Mal8rk
Tweeter
Tweeter
Posts: 154
Joined: Mon Oct 25, 2021 11:04 pm
Flair: I like socializing with people online
Pronouns: He/Him
Contact:

Re: minTimer.lua - Mini game timer from superstar saga! [v1]

Postby Mal8rk » Thu Nov 17, 2022 12:36 pm

Bro you just keep making more and more banger scripts! Thanks for making this!

PD: Is there a way to make the player die if they fail?

Marioman2007
Buster Beetle
Buster Beetle
Posts: 401
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: minTimer.lua - Mini game timer from superstar saga! [v1]

Postby Marioman2007 » Thu Nov 17, 2022 9:09 pm

Mal8rk wrote:
Thu Nov 17, 2022 12:36 pm
PD: Is there a way to make the player die if they fail?

The onEnd function runs when a timer reaches 0, so you could do:

Code: Select all

function timer1:onEnd(win) -- win is true if the timer closes before the it reaches 0
    if not win then
        player:kill()
    end
end

ElTipsta
Lakitu
Lakitu
Posts: 473
Joined: Fri Dec 20, 2013 3:16 pm
Pronouns: she/her

Re: minTimer.lua - Mini game timer from superstar saga! [v1]

Postby ElTipsta » Sun Feb 05, 2023 4:05 am

is there a maximum time limit this can be set to? if not, it could be used for full length level time challenges, which would be great :)

Marioman2007
Buster Beetle
Buster Beetle
Posts: 401
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: minTimer.lua - Mini game timer from superstar saga! [v1]

Postby Marioman2007 » Sun Feb 05, 2023 5:39 am

ElTipsta wrote:
Sun Feb 05, 2023 4:05 am
is there a maximum time limit this can be set to? if not, it could be used for full length level time challenges, which would be great :)
It supports 2 types of timers:
- minTimer.COUNT_DOWN: for challenges, counts down until it reaches 0 and passes a lua event to handle its onEnd function.
- minTimer.COUNT_UP: for timers, counts only up, useful for checking how much time a player spent into something.

And yes, you can set starting values for timers that count down, but you can't set a limit for counters that count up. Might make it a feature in the future.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests