Cover for the App

2.5D Platformer Player Controller

This is a sample project to show off a 2.5D Platformer Player Controller.

This is a sample project to show off a 2.5D Platformer Player Controller.

2.5D Platformer Player Controller

This project provides a robust movement system tailored for platformers using the Niantic Studio engine. It includes components for managing both vertical and horizontal player movement, with advanced features like coyote time and jump buffering to enhance gameplay responsiveness.

Project Info

The code is fully commented for clarity and ease of use. You can clone, customize, and integrate these components into your own projects to quickly add a comprehensive movement system.

Custom Component Overview

Input Controller

Manages input events for the player, handling both UI buttons and keyboard inputs. It listens for directional (left/right) and action (jump) inputs, dispatching corresponding events for other components to process.

Player Vertical Movement

Handles the player’s vertical movement logic, including jumping and state transitions. Key features include:

  • Coyote Time: A short grace period that allows players to jump even after they leave the ground, making the game more forgiving.
  • Double Jump: An optional feature that lets players jump again mid-air.
  • Jump Buffering: Ensures jumps triggered slightly before landing are executed as soon as the player touches the ground.

Player Horizontal Movement

Handles smooth horizontal movement with acceleration, deceleration, and speed clamping. Integrates seamlessly with the vertical movement system by reacting to the player’s grounded and in-air states.

Tags

A custom tagging system for adding identifiers to entities. This project uses a ground-tag component to identify ground entities, simplifying collision logic for the vertical movement system.

Key Terms

Coyote Time

Inspired by cartoons, coyote time gives players a brief window to jump even after leaving the ground. This feature improves gameplay responsiveness and reduces frustration by accounting for minor delays in player input.

Jump Buffering

Jump buffering ensures that inputs made just before landing are not ignored. If the player presses the jump button slightly too early, the jump will be executed as soon as the player lands, making controls feel more responsive.

Usage

  1. Input Controller Setup:

    • Add the input-controller component to the scene entity.
    • Configure your input mappings in the Inputs component by clicking on the scene entity and editing the world.input.getAction bindings.
  2. Vertical Movement:

    • Attach the player-vertical-movement component to the player entity.
    • Adjust parameters like jumpHeight, coyoteTime, and jumpBufferingTime to suit your gameplay.
  3. Horizontal Movement:

    • Attach the player-horizontal-movement component to the player entity.
    • Configure settings like moveSpeed, acceleration, and maxAirSpeed for smooth horizontal motion.
  4. Tagging System:

    • Add the ground-tag component to entities that should be recognized as ground (e.g., platforms or terrain). This enables seamless integration with the vertical movement system.

Tips

  • Input Events: Review the events dispatched by the input controller, such as LeftDown, RightDown, and JumpDown. These are crucial for integrating the movement system with other gameplay elements.
  • Customization: All key features (e.g., double jump, coyote time) are configurable in the component schemas. Experiment with different values to create the desired feel for your game.
  • Integration: The system is modular and can be adapted to work with additional mechanics like wall jumping or dashing.

Feedback

If you have questions or need help customizing the system, feel free to reach out!

Happy developing! 🚀