KinematicBody2D
is the node of choice for platformers.
Basically, the word "kinematic" in the name just means this is a node that's going to be moving around. There's no expectation for this node of what kind of movement code you're going to write for it (unlike RigidBody2D
).
So, you can write whatever movement code you want. It can be as simple as move one pixel left if the left key is just pressed (that is, no real physics at all), or so complex as to involve acceleration, different kinds of friction, mass, momentum, and so on (that is, tons of "real" physics). It's up to you how much you want to code the real physics in.
When blogs warn about using "real" physics in platformers, they are being somewhat vague. Basically, they are just warning devs not to go overboard with their physics model. Stick to simple attributes like velocity
, acceleration
, and friction
. Your Player probably doesn't need a mass
attribute.
I myself have built projects using only a velocity
variable (the movement is constant so long as a key is pressed, and when the key is released, movement is 0).
Also, don't be confused by Godot's virtual function _process_physics()
. This is where you'll write your KinematicBody's
movement code. The word "physics" in the name should be construed loosely. It's just where your movement code resides, however complex or simple it happens to be.