Advanced Jump Mechanics

Question

I wanna do a short Platformer and the jump is the main Game Mechanic
I don’t get why the Jump Height and Distance isn’t working correctly. If i set the Jump Height to 3, i should jump 3 “Blocks/Tiles” high. But the Jump Height seems also changing if i change the jump Peak time.
For Example/Jump_Hight is 3/Jump_Fall_time 0,25:
If Jump peak time is 0,3 → I jump 3 Blocks high
If Jump Peka time is 0.8 → i do a mini jump 1/4 Block high

Did anyboby why this is happening ?. I though if i race the Peak time i should jump faster



@export_category("Movement Parameters")
@export var Jump_peak_time: float = 0.27
@export var Jump_fall_time: float = 0.28
@export var Jump_height: float = 2.0
@export var Jump_distance: float = 5.0
@export var sprint_boost: float = 1.4


@export var Coyote_time:float = 0.1
@export var Jump_buffer_timer: float = 0.1

var speed: float = 5.0
var jump_velocity: float = 5.0
	#recalculate is to pixel
var pixel_jump_height:float = (16*Jump_height)
var pixel_jump_distance: float = (16*Jump_distance)








#New jump physics functions
func _ready() -> void:
	calculate_movement_parameters()


func calculate_movement_parameters() -> void:
	pixel_jump_height = (Jump_height) *16
	pixel_jump_distance = (Jump_distance) *16
	jump_gravity = (2*pixel_jump_height)/pow(Jump_peak_time,2)
	fall_gravity = (2*pixel_jump_height)/pow(Jump_fall_time,2)
	jump_velocity = jump_gravity * Jump_peak_time
	speed = pixel_jump_distance/(Jump_peak_time+Jump_fall_time)
	print ("distance: " + str(pixel_jump_distance))
	print("hight: " + str(pixel_jump_height))
	print("Speed: " + str(speed))


var fully_healt: bool = false

# Get the gravity from the project settings to be synced with RigidBody nodes.
var jump_gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var fall_gravity:float = 5.0


#Coyote Time
var jump_available: bool = true
func coyote_timeout():
	jump_available = false
	
#Jump Buffer
var jump_buffer = false
func jump() -> void:
		velocity.y -= jump_velocity
		jump_available = false
		jump_sound.play()
func on_jump_buffer_timeout() -> void:
	jump_buffer = false
	
#sprint 
func sprint():
	speed *= sprint_boost
	print("you sprint")


func _physics_process(delta: float):
	# Add the gravity.
	if not is_on_floor():
		if jump_available:
			get_tree().create_timer(Coyote_time).timeout.connect(coyote_timeout)
		
		if velocity.y>0:
			velocity.y += jump_gravity * delta
		else:
			velocity.y += fall_gravity * delta
		
	else:
		jump_available = true
		if jump_buffer:
			jump()
			jump_buffer = false

	# Handle jump.
	if Input.is_action_just_pressed("move_jump"): 
		if jump_available:
			jump()
		else:
			jump_buffer = true
			get_tree().create_timer(Jump_buffer_timer).timeout.connect(on_jump_buffer_timeout)
	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	var direction = Input.get_axis("move_left", "move_right")
	if direction:
		velocity.x = direction * speed
	else:
		velocity.x = move_toward(velocity.x, 0, speed)
		
	
	#handels Sprint
	if Input.is_action_just_pressed("move_sprint"):
		sprint()
	if Input. is_action_just_released("move_sprint"):
		calculate_movement_parameters()


	move_and_slide()