To Team Cherry, the creators of Hollow Knight and Silksong: I sincerely apologize for using any extracted sprites or assets from Hollow Knight in this project. ๐ This is purely a coding exercise to replicate the game's movement mechanics as a learning experience. I am not an artist and have no intention of claiming or redistributing your incredible work. This project is for educational purposes only, and I deeply respect your work. ๐
This project is a recreation of the player movement mechanics from Hollow Knight, a critically acclaimed 2D Metroidvania game, built using the Godot Engine (4.x). ๐ฎ The goal is to emulate the smooth, precise, and responsive movement of the Knight (and inspired by Hornet from Silksong), including features like 8-way movement, jumping, dashing, wall sliding, and wall jumping. This is a coding-focused project to study 2D platformer mechanics, with a focus on achieving the tight, fluid feel of Hollow Knight. ๐
- 8-Way Movement ๐: Smooth horizontal movement with input-based direction. (As of the first upload it just goes left/right w/Jump & slide mechanics)
- Jumping ๐ฆ: Precise, snappy jumps with a Hollow Knight-like arc (tuned with gravity ~2000 pixels/sยฒ and jump velocity ~-600).
- Dashing ๐จ: A quick burst of speed in the facing direction, with a lock on vertical movement.
- Wall Sliding ๐ง: Slow descent when holding toward a wall while falling.
- Wall Jumping ๐ฆ: Dynamic leaps off walls with directional pushback.
- Sprite Flipping ๐: The player sprite flips horizontally based on movement direction.
- Animation System ๐ฅ: State-based animations using
AnimatedSprite2Dfor idle, run, jump (rise/fall), dash, wall slide, and wall jump. - Camera System ๐ท: A Hollow Knight-style camera with smooth tracking, room-based limits, and dynamic zoom.
- Engine: Godot 4.x (GDScript) ๐
- Nodes:
CharacterBody2Dfor physics-based movement.AnimatedSprite2Dfor frame-based animations from sprite sheets.Camera2Dfor smooth player tracking and room transitions.
- Physics โ๏ธ:
- Gravity: ~2000 pixels/sยฒ to match Hollow Knight's snappy fall (approximated from Unity's ~-30 to -40).
- Jump Height: Tuned to cover ~2-3 sprite heights, similar to the Knight.
- Animation ๐๏ธ:
- Uses a state machine (
enum) to switch between animations (e.g.,idle,run,jump_rise,dash). - Animations are driven by a sprite sheet (12 FPS for a 12-frame animation lasts 1.0 second, as calculated).
- Sprite flipping via
flip_hfor directional facing.
- Uses a state machine (