inertia.lua - Keep your speed on moving npcs!

Share and discuss custom LunaLua code and content packs for SMBX2.
Master of Disaster
Rex
Rex
Posts: 35
Joined: Sun Nov 28, 2021 9:29 am
Flair: Average Koopa Fan
Pronouns: he/him

inertia.lua - Keep your speed on moving npcs!

Postby Master of Disaster » Sat Mar 09, 2024 9:50 am

You may know the moment when you are trying to platform on a moving platform (looking at you, red YI platform) and it's hard to stay on the platform and feels wrong as well.
The lack of inertia in SMBX bothered me at least, so here's a little library that fixes that!

inertia.lua v1.0

With this library you keep your momentum on moving npcs, making it a lot easier to stay on a moving platform.
Additionally, your jump height is effected by the vertical speed of the platform! You can get quite a lot of distance with that.

You can customize how it works with these:

Code: Select all

local inertia = require("inertia") -- loads the library

inertia.keepSpeed = 1 -- how much speed you keep when leaving the platform
inertia.maxJumpSpeed = -16 -- the highest vertical speed you can get when jumping off a moving platform
inertia.minJumpSpeed = -3   -- the lowest vertical speed you get when jumping off a moving platform.
inertia.maxSpeedX = 6          -- highest horizontal speed. If > 6, you can get faster than your normal running speed, it reverts back to normal when landing
here's a little bit of footage:
Spoiler: show
inertia off:
Image

inertia on:
Image

credit if used yadda yadda you know the drill

Here's the download:
https://www.dropbox.com/scl/fo/4in7q8fj ... zn5pp&dl=0

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

Re: inertia.lua - Keep your speed on moving npcs!

Postby AirShip » Sat Mar 09, 2024 12:41 pm

Inertia, my beloved--
Great work, useful as always!

King Mario
Hoopster
Hoopster
Posts: 122
Joined: Sun Nov 19, 2017 2:13 pm
Flair: Jesus Christ is Lord!
Pronouns: he/him
Contact:

Re: inertia.lua - Keep your speed on moving npcs!

Postby King Mario » Sat Mar 09, 2024 8:22 pm

When I try it, an error appears saying that "jumpspeed" does not exist. Know how to fix this?

Master of Disaster
Rex
Rex
Posts: 35
Joined: Sun Nov 28, 2021 9:29 am
Flair: Average Koopa Fan
Pronouns: he/him

Re: inertia.lua - Keep your speed on moving npcs!

Postby Master of Disaster » Mon Mar 11, 2024 8:55 am

King Mario wrote:
Sat Mar 09, 2024 8:22 pm
When I try it, an error appears saying that "jumpspeed" does not exist. Know how to fix this?
jumpspeed doesn't exist? That's an error message you get when using beta 4, since Defines.jumpspeed was recently added in beta 5.
If you are still using beta 4, I'd advice you to update smbx, as there is no reason to not do

King Mario
Hoopster
Hoopster
Posts: 122
Joined: Sun Nov 19, 2017 2:13 pm
Flair: Jesus Christ is Lord!
Pronouns: he/him
Contact:

Re: inertia.lua - Keep your speed on moving npcs!

Postby King Mario » Tue Mar 12, 2024 3:50 pm

I switched to Beta 5 and it works! Thank you for the suggestion.

Blake Izayoi
Posts: 584
Joined: Sun Feb 23, 2014 1:55 pm
Flair: Sakuya's Husband
Pronouns: He / Him
Contact:

Re: inertia.lua - Keep your speed on moving npcs!

Postby Blake Izayoi » Sun Mar 17, 2024 8:49 pm

This will absolutely come in handy in a lot of scenarios. Marvelous work!


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari