Skip to content

Instantly share code, notes, and snippets.

View Deledrius's full-sized avatar

Joseph Davies Deledrius

View GitHub Profile
@Deledrius
Deledrius / better_jumping_character_example.gd
Last active March 8, 2025 15:28 — forked from sjvnnings/better_jumping_character_example.gd
An easy to work with jump in Godot 4.x
extends CharacterBody2D
@export var move_speed = 200.0
@export var jump_height : float
@export var jump_time_to_peak : float
@export var jump_time_to_descent : float
@onready var jump_velocity : float = ((2.0 * jump_height) / jump_time_to_peak) * -1.0
@onready var jump_gravity : float = ((-2.0 * jump_height) / (jump_time_to_peak * jump_time_to_peak)) * -1.0
@onready var fall_gravity : float = ((-2.0 * jump_height) / (jump_time_to_descent * jump_time_to_descent)) * -1.0