character modell change + character movement changes

This commit is contained in:
Booklordofthedings 2024-08-16 23:16:25 +02:00
parent 96f67e78e9
commit 096a6126c1
5 changed files with 48 additions and 8 deletions

View file

@ -3,7 +3,7 @@ extends CharacterBody2D
@export var speed = 340;
@export var gravity = 50;
@export var jump_count = 2;
@export var jump_strength = 700;
@export var jump_strength = 100
var jump_count_current = 2;
var input_direction = 0 #To keep track of which direction we where moving in last frame
@ -24,14 +24,16 @@ func get_input():
velocity.x = input_direction * speed
if is_on_floor():
jump_count_current = jump_count
if Input.is_action_just_pressed("player_jump") and jump_count_current > 0:
velocity.y = -1 * jump_strength
jump_count_current = jump_count_current-1
elif Input.is_action_pressed("player_jump"): #Fall less fast if we keep holding the button
velocity.y += -1 * 20
velocity.y += -1 * 25
if is_on_floor():
jump_count_current = jump_count
func _physics_process(delta):
get_input()