[LunaLua] Time limit to stay underwater

This is the place for discussion and support for LunaLua and related modifications and libraries.
User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

[LunaLua] Time limit to stay underwater

Postby Prado » Tue Jan 12, 2016 3:26 pm

I made a simple system of oxygen limit, you have to get out of the water to breathe, or you will die.

Thanks to the efforts of lotus006, this thing was improved, because I was going to never finish it. Thank you lotus006 8-)

It's recomended to download the latest version in this list.


Oxygen meter 1.0(made by me, ancient version[the worst version, please don't download this one])


LsBreathMeter 1.0(made by lotus006)


LsBreathMeter 1.1(made by lotus006)


LsBreathMeter 1.2(made by lotus006)


LsBreathMeter 2.A(made by lotus006)
Spoiler: show


lotus006 wrote:Patch note 2 : Enjoy Final Release LsBreathMeter2.A.zip
https://drive.google.com/open?id=0B9Yha ... HZSbHlvV1k
> Hud go back to the other player and show incorrect air value [Fixed]
> Remasterised Hud for better performance [Updated]
> Lua code improved and optimised again :D [Updated]
--------------------------------------------------------------------------------------------------
New Stuff
> Added API command for adjusting and control Breath time and/or can be Enabled or Disabled now [Added]
> Added Button "CTRL" for invisible flooding the level to test easier the API [Added]


You need to put this into your lunaworld from the episode wanted. or in the folder battle for Battle Mode
CODE: SELECT ALL
local LsBreathMeter = API.load("LsBreathMeter"); -- Thanks to Enjl , it's fixed

Put this on onLoad section ( OPTIONAL Not needed if you wont change thing... ) Sorry forgot to say.
CODE: SELECT ALL
function onStart() -- Fixed Also ,thanks again Enjl :D
LsBreathMeter.AirMultiplierP1(Multiplier) -- Settings API for Adjusting Time decreasing of the Breath --> 1 or less decreasing slower, 1 and more decreasing faster.
LsBreathMeter.AirMultiplierP2(Multiplier)
LsBreathMeter.hudBreath(true/false) -- Enable/Disable API
LsBreathMeter.ControlFlood(true/false) -- Enable/Disable Flooding level (invisible flooding) for both player when pressing CTRL , if Disabled CTRL dont flood
end

Misc --> put this IF YOU WANT TO USE WITH YOUR API, or else not needed ... into your API to access on the Air time for player(s) wanted
CODE: SELECT ALL
LsBreathMeter = loadSharedAPI("LsBreathMeter");

[ Note : should be on onTick() or onLoop() ]
CODE: SELECT ALL
LsBreathMeter.ReturnAirTimeP1()
LsBreathMeter.ReturnAirTimeP2()





DOWNLOAD

https://drive.google.com/open?id=0B9Yha ... HZSbHlvV1k
Last edited by Prado on Thu Apr 14, 2016 2:45 pm, edited 5 times in total.
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

User avatar
Tango
Volcano Lotus
Volcano Lotus
Posts: 571
Joined: Fri Apr 25, 2014 12:06 pm
Current Project: Working on some spicy tunes
Location: My house
Chat Username: Tango
Contact:

Re: [LunaLua] Time limit to stay underwater

Postby Tango » Wed Jan 13, 2016 9:28 am

Neat! Awesome product!

It's very basic for now, but is very cool. Can't wait for the updates, mainly the bar thing.

Good luck!
Walter wrote:always remember to hydrate yourself when drinking alcohol

User avatar
fireflower30
Fighter Fly
Fighter Fly
Posts: 79
Joined: Wed Sep 23, 2015 2:24 pm
Current Project: Project Hedgehog (WORKING ON IT), Bowser Boss Rush Project (MAKING 2.0 FRIENDLY VERSION)
Contact:

Re: [LunaLua] Time limit to stay underwater

Postby fireflower30 » Wed Jan 13, 2016 11:32 am

A few more luas and we can implement sonic
"No Copyright law in the universe is gonna stop me!" -Sonic, Sonic COLORS

I Endorse /r/fnafcringe, the Subreddit that shows anything from the bad part of the FNAF Fanbase, the FNAF Hatebase, MS Paintings, and YT Cinemas.

"There's nothing I can do without raising the Game's Rating"

User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Wed Jan 13, 2016 11:48 am

fireflower30 wrote:A few more luas and we can implement sonic


It would not be hard to implement Sonic's panic sound in this code :idea:
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: [LunaLua] Time limit to stay underwater

Postby lotus006 » Thu Jan 14, 2016 5:56 am

Prado wrote:
fireflower30 wrote:A few more luas and we can implement sonic


It would not be hard to implement Sonic's panic sound in this code :idea:


Dont forget Bubbles !!
and maybe air supply in the water :P

User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Thu Jan 14, 2016 6:46 am

Bubbles already work in this code, because you will lose oxygen only in water zones.

About air supply, you easily could add to the code a condition to add a certain value to oxygen after picking up a NPC (coin, bubble or anything else) 8-)
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

PeachGaveMeFlurries
Shy Guy
Shy Guy
Posts: 9
Joined: Fri Jan 15, 2016 3:00 pm

Re: [LunaLua] Time limit to stay underwater

Postby PeachGaveMeFlurries » Fri Jan 15, 2016 7:25 pm

Wow, I don't know how people write code, this doesn't make any sense to me.

User avatar
GhostHawk
Mario
Mario
Posts: 4264
Joined: Fri Mar 28, 2014 2:51 pm
Location: The Everglades
Chat Username: GhostHawk
Contact:

Re: [LunaLua] Time limit to stay underwater

Postby GhostHawk » Fri Jan 15, 2016 8:36 pm

This looks pretty good, however your code is very inefficient with getting the oxygen value. All you need to do is this:

Code: Select all

function updateOxygen(timer)
   oxygen = math.abs(math.ceil((timer / 65) / 3))
end


It's usually bad practice in any language to have long chains/blocks of code like the if statements you had so keep that in mind in the future. Besides that though this looks pretty useful, nice work!
Image

Hey social butterfly
Can you look me in the eye
and tell me you don’t care for me
Hey social butterfly
If I’m in disguise
Maybe you will cry for me.

I’m in a well, I need a rope
Just drop it down
I’m in a well, just need some help
Please send it down.

User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Sat Jan 16, 2016 5:55 am

Thanks AeroMatter, I make no idea of what those math functions do, but I will study it :)

EDIT: Ok, I know what they do now, using a calculator I understood your code, but how to discover what numbers use?

I mean, how to know that I have to use 65 and 3 ?

EDIT 2: I understood everything now! Divided by 65 because the timer = 30*65, then divided by 3 to get the value between 0 and 10! Thank you for this!

Super Mario 64 power meter coming in next update!
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

User avatar
GhostHawk
Mario
Mario
Posts: 4264
Joined: Fri Mar 28, 2014 2:51 pm
Location: The Everglades
Chat Username: GhostHawk
Contact:

Re: [LunaLua] Time limit to stay underwater

Postby GhostHawk » Sat Jan 16, 2016 9:05 am

Prado wrote:Thanks AeroMatter, I make no idea of what those math functions do, but I will study it :)

EDIT: Ok, I know what they do now, using a calculator I understood your code, but how to discover what numbers use?

I mean, how to know that I have to use 65 and 3 ?

EDIT 2: I understood everything now! Divided by 65 because the timer = 30*65, then divided by 3 to get the value between 0 and 10! Thank you for this!


No problem.

What you did here for your second edit though is a good first step because you basically figured it out on your own, and can apply the same reasoning to other situations.
Image

Hey social butterfly
Can you look me in the eye
and tell me you don’t care for me
Hey social butterfly
If I’m in disguise
Maybe you will cry for me.

I’m in a well, I need a rope
Just drop it down
I’m in a well, just need some help
Please send it down.

User avatar
h2643
Ludwig von Koopa
Ludwig von Koopa
Posts: 2861
Joined: Sat Dec 21, 2013 7:23 am
Current Project: RL
Location: Ukraine (Украина)
Chat Username: h/a troll

Re: [LunaLua] Time limit to stay underwater

Postby h2643 » Sat Jan 16, 2016 9:21 am

You should really post your API at PGE Wiki: http://engine.wohlnet.ru/pgewiki/Catego ... _libraries Just a suggestion.
Anyway I can't wait to see the new version of this API. Keep up the good work!
Image Image Image
Image Image Image
Image Image Image

User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Sat Jan 16, 2016 11:20 am

I will be busy now making my CC12 level, but after this I will return to work!
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

User avatar
mariofan 64
Blooper
Blooper
Posts: 189
Joined: Mon Oct 13, 2014 2:14 am
Current Project: stuff in rpg maker and arc 1 of mario videos

Re: [LunaLua] Time limit to stay underwater

Postby mariofan 64 » Tue Feb 23, 2016 8:18 am

Hey, will there be the timer upgrade?
Also, is it ok if I can use this in a project? I'd appreciate it because it would seem odd if one spent 5 minutes in water doing water puzzles when you can have land portions to levels as well.
I has youtube now...with some activity :D

Projects: Infinite Mario Bros. For PGE (On the PGE Website, of course) (temp hiatus for other projects, see second link in spoiler for details)
----------RPG games, not related to Mario at all :/
----------A ???? game made in Gamemaker.

Completed: Schedules, Plans, Pages, And Other Things

Processing...Processing...Completed. See message below:
Spoiler: show
Mario Infinity: Quest to Stabilize the World (WIP)
http://engine.wohlnet.ru/forum/viewtopic.php?f=56&t=568
FACEBOOKS:
https://www.facebook.com/EBTKSPaddy
MAI PATREON:
https://www.patreon.com/ebtkspaddy
MAH FRIEND'S YOUTUBES WHERE ME AND MAH FRIEND'S ARE AT:
https://www.youtube.com/channel/UCRoSEH ... rVJdozjwUA

User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Tue Feb 23, 2016 5:05 pm

mariofan 64 wrote:Hey, will there be the timer upgrade?
Also, is it ok if I can use this in a project? I'd appreciate it because it would seem odd if one spent 5 minutes in water doing water puzzles when you can have land portions to levels as well.


Use it on whatever you want! And the update... I don't know if I'm going to make it, because I'm wasting a lot of my free time studying C++, but ocasionaly I can make it. Sorry for this.
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: [LunaLua] Time limit to stay underwater

Postby lotus006 » Sun Feb 28, 2016 6:32 am

Hi Prado I remake from scratch your Air Timer breath and just wanna know if it's ok for you if I continue this one instead ?
If any one have other idea what to add dont hesitate if Prado it's ok for you ? ( I never tried your api but you make me want to try to do one :D )

PS: the idea credit come from you :)

Maybe I can add Mario 64 hud :D


User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Sun Feb 28, 2016 7:32 am

It's ok!

I would apreciate very much if someone continues the idea, since I am busy studying C++ :D
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image

Super Mario Channel
Bit
Bit
Posts: 149
Joined: Sun Dec 06, 2015 8:08 am

Re: [LunaLua] Time limit to stay underwater

Postby Super Mario Channel » Sun Feb 28, 2016 7:48 am

For some strange reason, I thought the title said "Time Limit to Stay in Underwear"
Anyways, this might be useful if I ever decide to start doing LunaLua.
DELETE THIS ACCOUNT PLZ

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: [LunaLua] Time limit to stay underwater

Postby lotus006 » Sun Feb 28, 2016 3:04 pm

Prado wrote: It's ok!

Ok then I'll try to enhance more this one , :D
Super Mario Channel wrote:For some strange reason, I thought the title said "Time Limit to Stay in Underwear"
Anyways, this might be useful if I ever decide to start doing LunaLua.


For the text in number about time limit is not be hard to add , I will make it toggable dont worry :D

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: [LunaLua] Time limit to stay underwater

Postby lotus006 » Mon Feb 29, 2016 6:11 am

Update : With Mario N64 Hud Air Meter :D

User avatar
Prado
Lakitu
Lakitu
Posts: 496
Joined: Tue Aug 05, 2014 10:10 am
Location: Brazil

Re: [LunaLua] Time limit to stay underwater

Postby Prado » Mon Feb 29, 2016 3:03 pm

Wow, amazing! Thanks for the sequel :) :) :)
Jesus is our lord and savior

My LunaLua examples:(IMPORTANT UPDATE)


Conheça o fórum brasileiro de SMBX!

http://gameengineworld.freeforums.org/index.php

Check out my youtube channel

https://www.youtube.com/channel/UCDlHpUPF-baURFhsgb-ga_g

Image


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests