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

@@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=3 uid="uid://bmatavjyacfwg"] [gd_scene load_steps=3 format=3 uid="uid://c5qbqj52kr0aw"]
[ext_resource type="PackedScene" uid="uid://dhhnr3xkxbxlu" path="res://player.tscn" id="1_vonw3"] [ext_resource type="PackedScene" uid="uid://dhhnr3xkxbxlu" path="res://player.tscn" id="1_vonw3"]
[ext_resource type="PackedScene" uid="uid://bsv3h2lpv7h77" path="res://virus.tscn" id="2_oi3di"] [ext_resource type="PackedScene" uid="uid://bsv3h2lpv7h77" path="res://virus.tscn" id="2_oi3di"]

View File

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

View File

@@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="growth" config/name="growth"
run/main_scene="uid://bmatavjyacfwg" run/main_scene="uid://dhhnr3xkxbxlu"
config/features=PackedStringArray("4.5", "GL Compatibility") config/features=PackedStringArray("4.5", "GL Compatibility")
config/icon="res://icon.svg" config/icon="res://icon.svg"
@@ -37,16 +37,6 @@ move_up={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
] ]
} }
dash={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
play_card={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
cycle_card_left={ cycle_card_left={
"deadzone": 0.2, "deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
@@ -57,6 +47,16 @@ cycle_card_right={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
] ]
} }
play_card={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
dash={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering] [rendering]