fix: player bugs

This commit is contained in:
SondreElg
2025-10-04 17:07:57 +02:00
parent f4ef64ef18
commit 1032278c46
3 changed files with 23 additions and 25 deletions

View File

@@ -31,15 +31,16 @@ var dash_cooldown_timer = 0;
var dash_on_cooldown = false;
func update_move_direction():
if Input.is_action_pressed("move_right"):
move_direction.x += 1
if move_direction.is_action_pressed("move_left"):
move_direction.x -= 1
if Input.is_action_pressed("move_down"):
move_direction.y += 1
if Input.is_action_pressed("move_up"):
move_direction.y -= 1
move_direction = move_direction.normalize()
move_direction = Vector2.ZERO
if Input.is_action_pressed("move_right"):
move_direction.x += 1
if Input.is_action_pressed("move_left"):
move_direction.x -= 1
if Input.is_action_pressed("move_down"):
move_direction.y += 1
if Input.is_action_pressed("move_up"):
move_direction.y -= 1
move_direction = move_direction.normalized()
func update_target_coords():
target = get_viewport().get_mouse_position()
@@ -56,7 +57,7 @@ func charge():
charge_level = max(charge_level - charge_rate * 2, 0);
func dash():
var card = hand[active_card_index];
var card = hand.get(active_card_index);
if not card or dash_on_cooldown:
return;
@@ -139,6 +140,3 @@ func _process(delta):
elif Input.is_action_just_pressed("cycle_card_right"):
action_state = ActionState.Cycling;
cycle_card(1);
elif Input.is_action_pressed("charge"):
action_state = ActionState.Charging;
charge();