easyliquids.lua - Flood your levels with code!

Share and discuss custom LunaLua code and content packs for SMBX2.
Akromaly
Bronze Yoshi Egg
Bronze Yoshi Egg
Posts: 425
Joined: Sun Mar 12, 2017 8:07 am
Flair: anemoia
Contact:

easyliquids.lua - Flood your levels with code!

Postby Akromaly » Sun Feb 18, 2024 1:51 pm

Have you ever made a level with water or lava and thought: "man, placing these things sure is tiring, huh". Well, fear not, because we're in the future and LunaLua can do that just for you!

easyliquids.lua is a library made to easily fill sections with water or lava, but it also provides some advanced features to customize them and make them move in funny and convenient ways! Here's an example:

code: show

Code: Select all

local easyliquids = require("easyliquids")

easyliquids.levelLiquids = {
    [0] = {
        liquidtype = easyliquids.TYPE_WATER,
        height = 40,
        targetheight = 90,
        goback = true,
        waittime = 1
    },
    [1] = {
        liquidtype = easyliquids.TYPE_LAVA,
        blockheight = 2,
        targetblockheight = 4,
        easing = easyliquids.EASING_INOUTSINE,
        goback = true,
        movetime = 2
    }
}
Image

To use the library, unzip the easyliquids.zip file into your custom level folder. Then, create a luna.lua file (if you haven’t already made one) and insert this line of code:

Code: Select all

local easyliquids = require("easyliquids")
NOTE: The library is only compatible with SMBX2 Beta 5.

NOTE: By default, the library uses the SMM2 styled water included in the zip file. If you don’t need it, you can avoid copying the image file to your level folder.

NOTE: If you’re using respawnRooms.lua, add this code to your luna.lua file to make the library work properly on respawn:

Code: Select all

function respawnrooms.onPostReset(fromRespawn)
    easyliquids.initLiquids()
end
Here you can find some proper explanation of every feature, with some more examples:
Documentation

Finally, here's the download:
Download
Last edited by Akromaly on Sun Feb 25, 2024 6:07 pm, edited 1 time in total.

Murphmario
Chargin' Chuck
Chargin' Chuck
Posts: 2382
Joined: Fri Dec 20, 2013 7:07 pm
Pronouns: he/him

Re: easyliquids.lua - Flood your levels with code!

Postby Murphmario » Sat Feb 24, 2024 9:24 am

May I suggest changing the download and image links to something else? Discord links are no longer permanent.

This looks very useful BTW, nice job.

Akromaly
Bronze Yoshi Egg
Bronze Yoshi Egg
Posts: 425
Joined: Sun Mar 12, 2017 8:07 am
Flair: anemoia
Contact:

Re: easyliquids.lua - Flood your levels with code!

Postby Akromaly » Sun Feb 25, 2024 6:09 pm

Murphmario wrote:
Sat Feb 24, 2024 9:24 am
May I suggest changing the download and image links to something else? Discord links are no longer permanent.

This looks very useful BTW, nice job.
Moved the download link to Google Drive! Thanks for the suggestion :)

FireSeraphim
Bit
Bit
Posts: 76
Joined: Wed Apr 16, 2014 4:21 pm
Flair: Verified Professional Vampire Hunter
Contact:

Re: easyliquids.lua - Flood your levels with code!

Postby FireSeraphim » Wed Mar 06, 2024 6:02 pm

Can I convince you to perhaps cook up some example presets that faithfully recreates the layer two water presets from SMW. From the top of my head I remember that all the SMW Layer 2 water presets always has the water pushing the player leftwards because the water is always moving leftwards and there's a low tide preset of about three block high (SMW W1-4 "Yoshi's Island 4")
and a raising and lowering tide preset (SMW 9-6 "Mondo") that starts like this:
1. It starts at five blocks high, and after after 21 seconds raises to eight blocks high in four seconds.
2. Remains at eight blocks high for eight seconds then it lowers to a height of one block after eight seconds.
3. Remains at one block high for eight seconds then raises to eight blocks high in eight seconds.
4. 2 and 3 are repeated indefinitely.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 5 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari