Making a Platformer in Lenga: Part 1 — Movement and Jumping
In this tutorial, we'll build a simple platformer controller using the systems Lenga already exposes cleanly today: `Behaviour` scripting, `Input`, `Rigidbody2D`, and grounded checks. By the end, you'll have a character that moves left and right, jumps with a configurable impulse, and can be tuned directly from the Inspector.
In this tutorial, we'll build a simple platformer controller using the systems Lenga already exposes cleanly today: Behaviour scripting, Input, Rigidbody2D, and grounded checks. By the end, you'll have a character that moves left and right, jumps with a configurable impulse, and can be tuned directly from the Inspector.
Start by creating a GameObject with a SpriteRenderer, a Rigidbody2D, and a BoxCollider2D. Set the rigidbody to Dynamic, keep gravity enabled, and make sure the collider is not a trigger. If you want the character to animate, add SpriteAnimation too, but that is optional for the movement pass.
Now add a PHP script called PlayerController that extends Behaviour. Cache the Rigidbody2D in awake(). In update(), read Input::getAxis('Horizontal') and store the desired move direction. If the player presses Jump, buffer that intent rather than changing physics immediately. Then in fixedUpdate(), apply horizontal velocity and, when isGrounded() is true, call addForce(..., ForceMode2D::Impulse) for the jump. That split keeps input responsive without fighting the fixed physics step.
The nice part of this setup is that your tuning values can stay as public properties on the script, so designers can adjust moveSpeed, jumpForce, or follow-up options like air control directly from the Inspector. Once the base controller feels good, it becomes much easier to layer in polish such as animation state changes, coyote time, jump buffering, wall movement, or a camera follow script.
In the next part, we'll build on that foundation with more platformer-specific feel work. For now, aim for something simple and trustworthy: stable movement, a dependable jump, and values that are easy to tune.