#2D Mario Physics
30 messages · Page 1 of 1 (latest)
😱 I AM LOVING THIS! 😭
holy crap, that's awesome!! :D
is this just gonna remain a test thing, or is this a sort of gateway into some sort of larger project...?
I'm mostly making this to train myself in coding quality platformer character movement in Godot.
But... I have had thoughts of recreating some of my Super Mario Maker 2 creations here.
Woah i'm curious as to how you pulled this off, im making a project that needs mario physics, and having them be accurate would be nice
Well, is there anything specific you'd like to know?
The gist I'll say right now is that Mario is a CharacterBody2D, and is not using any RigidBody physics. Mario uses linear interpolation for his left and right movement, and his jump uses a specific formula that I learned from this:
Manually tweaking your character's jump velocity and gravity in Godot is hardly an effective way to make a jump. It's imprecise, and above all, tedious to make something that actually feels good to play. In this video, you'll learn how to make a jump you can actually use in your game, by breaking it down into real parameters you already know how...
One other important thing I'll mention is that, even though Mario has a RectangleShape2D for his collision, I have conditions set to where he'll "snap" past solid corners if he jumps up to them and is far enough past them by the time he makes contact with them. He'll retain his upward velocity as well.
Something has always felt off about these physics to me
i used a curve for the jump and everything
or
not curve
you know what i mean
Ah. Well, heh, fun fact, I didn't use any curve tool.
Yeah i know thats why i said not curve
i mean more as in controlling the curve of the jump
Yeah
i'll probably restructure my stuff some time later since i just got finished with a game jam and im real tired lol
This method is called whenever the player presses the jump button during an "Idle", "GroundMove", or "Crouch" state in my script.
From my findings of the official games, Mario has 4 different jump strengths from the ground. Only one executes depending on Mario's X velocity at the frame of the jump input.
Thus, you see the constants: "maxStandingJumpStrength", "maxWalkingJumpStrength1", etc.
To clarify, these constants represent the highest Mario is able to jump if the player continues to hold the jump button during a "Jump" state.
Once one is assigned to the "currentJumpStrength" value, the formulae below are used to control Mario's jump arc.
There are a few other factors at play that allow for the perfect replication of Mario's jump to execute in Godot. But I think this is the big part of it. Hope it helps!
Very nice