This script allows the player to twirl like in New Super Mario Bros. Wii/U.
Works for 2 players v2.2: Now compatible with "dive.lua!" v2.3: Changed audio file to .ogg and tweaked default settings.
* Press the Alt-Jump/Spin key in mid-air
* Only Mario, Luigi and Toad can do this
The twirl gives you a bit of momentum in mid-air. So it's useful for jumps that aren't high enough to reach certain places in a level, and it can save you from some otherwise hopeless situations.
1. Extract both "twirl.lua" and the "twirl.flac" together into your episode/level folder.
2. Paste the following line into your level/episode's luna.lua file.
twirl.descent = Int | Sets this to the Y speed WHEN DESCENDING in order to achieve a slower fall. twirl.impulsePercent = Int | Multiplies this with Y speed WHEN ASCENDING in order to reach a higher jump. twirl.extraImpulse = Int | Substracts this to Y speed WHEN ASCENDING in order to reach an even higher jump. twirl.cooldown = Int | Amount of ticks between twirls.
Default Values:
Copy and paste these to your luna.lua file if you want to edit them:
twirl.descent = 1.5
twirl.impulsePercent = 1.5
twirl.extraImpulse = 1.3
twirl.cooldown = 10
Writing this was a good way to spend my time. It has been interesting seeing myself grow up and learn lua every day since I was 16. Each time I went back to this I saw ways to shrink the code and improve my bad habits and It's been 4 years. It's always such a good feeling when something works!
This community has inspired me in a way you can't imagine. And although I barely like to socialize, I really wanted to thank you all so much for inspiring me!
This looks useful, does it give the player an extra bit of momentum like it did in the NSMB games to allow the player to go a little bit further, or is it just an effect?
This looks useful, does it give the player an extra bit of momentum like it did in the NSMB games to allow the player to go a little bit further, or is it just an effect?
Oh yeah. I did it intentionally so that when the player press to twirl, give him a bit of momentum.
Edit: I think i haven't said it clearly. Sorry, don't speak english frequently There's two types of momentum. Before he gets to the top of the jump and when he starts to fall.
When he's about to get to the maximum height after jumping and he presses to twirl in the middle of the action, it cancells the jump in midair and gives him a lower push upward.
When he falls, it restores the Y speed into 1 and removes the speed he gained through the fall.
(Also when i putted 0 instead he could spinjump in air which is a fun fact)
Why does your "mem recognition function" use global variables? With the unusual but not-completely-insane structure of your code, it'd work to declare them as local to the whole file.
Why does your "mem recognition function" use global variables? With the unusual but not-completely-insane structure of your code, it'd work to declare them as local to the whole file.
and "if var == true" is the same thing as "if var"
If so, i see your point. And it doesn't make much sense that i haven't did it before because i knew it. However, i was scared to make a dumb mistake somewhere, lost the mistake (That doesn't necessarily needs to be a crash), and rewrite for the 4th time.
If var == true then
var2 == true
else
var2 == false
end
This can be done on one line like this:
var2 = var
It's a lot easier to keep track of what your code is doing with the second way, and it's generally good practice to do that if your only going to be changing a boolean type within a conditional. For the parts of your code that did this, I rewrote what it would look like with the second format and it should produce the same results as your code but done more concisely.
If var == true then
var2 == true
else
var2 == false
end
This can be done on one line like this:
var2 = var
It's a lot easier to keep track of what your code is doing with the second way, and it's generally good practice to do that if your only going to be changing a boolean type within a conditional. For the parts of your code that did this, I rewrote what it would look like with the second format and it should produce the same results as your code but done more concisely.
This is so cool. Subtle differences like this might change up the game a bit more.
Well i used this script for my cancelled 2.0 project but the people who played it never used the twirl for some weird reason so idk if it will change anything that much.
This is so cool. Subtle differences like this might change up the game a bit more.
Well i used this script for my cancelled 2.0 project but the people who played it never used the twirl for some weird reason so idk if it will change anything that much.
Huh, that's interesting. I would have thought people would make the most use out of a feature.
Hey! I just updated this script to be compatible with peach and other characters. Other cool stuff on the changelog which is in the .lua file itself! Just redownload it from the same links provided in the post above!