From 5d9489581c448e8450ed20a5fc24f2dd77d9ba69 Mon Sep 17 00:00:00 2001 From: Raxki Date: Sun, 8 Sep 2024 15:50:49 -0400 Subject: [PATCH] Fix Hiro attacking when holding attack button and adjust collider --- Hiro/hiro_player.tscn | 60 +++++++++++++++++++++--------------------- Scripts/hiro_player.gd | 4 +-- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Hiro/hiro_player.tscn b/Hiro/hiro_player.tscn index 9ce284a..f9987a2 100644 --- a/Hiro/hiro_player.tscn +++ b/Hiro/hiro_player.tscn @@ -596,10 +596,10 @@ tracks/6/path = NodePath("Attackbox/Collider:position") tracks/6/interp = 1 tracks/6/loop_wrap = true tracks/6/keys = { -"times": PackedFloat32Array(0, 0.133333, 0.266667), -"transitions": PackedFloat32Array(1, 1, 1), +"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(12, -11), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(6, -11), Vector2(6, -11), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_cuaji"] @@ -650,7 +650,7 @@ tracks/3/path = NodePath("Sprite2D:frame") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { -"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2), +"times": PackedFloat32Array(0, 0.0666667, 0.1334, 0.2), "transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, "values": [35, 36, 37, 38] @@ -674,10 +674,10 @@ tracks/5/path = NodePath("Attackbox/Collider:disabled") tracks/5/interp = 1 tracks/5/loop_wrap = true tracks/5/keys = { -"times": PackedFloat32Array(0, 0.133333, 0.266667), -"transitions": PackedFloat32Array(1, 1, 1), +"times": PackedFloat32Array(0, 0.133333, 0.1334, 0.266667), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [true, false, true] +"values": [true, false, false, true] } tracks/6/type = "value" tracks/6/imported = false @@ -689,7 +689,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(0, -30), Vector2(12, -11), Vector2(0, -30), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(0, -27), Vector2(12, -11), Vector2(0, -27), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_hqga6"] @@ -779,7 +779,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(0, 2), Vector2(12, -11), Vector2(0, 2), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -2), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_s8xim"] @@ -866,10 +866,10 @@ tracks/6/path = NodePath("Attackbox/Collider:position") tracks/6/interp = 1 tracks/6/loop_wrap = true tracks/6/keys = { -"times": PackedFloat32Array(0, 0.133333, 0.266667), -"transitions": PackedFloat32Array(1, 1, 1), +"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(-12, -11), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_o0diw"] @@ -956,10 +956,10 @@ tracks/6/path = NodePath("Attackbox/Collider:position") tracks/6/interp = 1 tracks/6/loop_wrap = true tracks/6/keys = { -"times": PackedFloat32Array(0, 0.133333, 0.266667), -"transitions": PackedFloat32Array(1, 1, 1), +"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(12, -11), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(4, -11), Vector2(6, -11), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_ar6r3"] @@ -1046,10 +1046,10 @@ tracks/6/path = NodePath("Attackbox/Collider:position") tracks/6/interp = 1 tracks/6/loop_wrap = true tracks/6/keys = { -"times": PackedFloat32Array(0, 0.133333, 0.266667), -"transitions": PackedFloat32Array(1, 1, 1), +"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(12, -11), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(6, -11), Vector2(6, -11), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_1e0v6"] @@ -1139,7 +1139,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(0, -30), Vector2(12, -11), Vector2(0, -30), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(0, -27), Vector2(12, -11), Vector2(0, -27), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_bwm5c"] @@ -1229,7 +1229,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(0, -30), Vector2(12, -11), Vector2(0, -30), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(0, -26), Vector2(12, -11), Vector2(0, -26), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_qmuik"] @@ -1319,7 +1319,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(0, 2), Vector2(12, -11), Vector2(0, 2), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -4), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_bw220"] @@ -1409,7 +1409,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(0, 2), Vector2(12, -11), Vector2(0, 2), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -2), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_wjl2t"] @@ -1499,7 +1499,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(-12, -11), Vector2(12, -11), Vector2(-12, -11), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(12, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_e4rxs"] @@ -1589,7 +1589,7 @@ tracks/6/keys = { "times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667), "transitions": PackedFloat32Array(1, 1, 1, 1, 1), "update": 1, -"values": [Vector2(0, -11), Vector2(-12, -11), Vector2(12, -11), Vector2(-12, -11), Vector2(-0.00060463, -11)] +"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(12, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)] } [sub_resource type="Animation" id="Animation_de3xn"] @@ -2041,12 +2041,6 @@ position = Vector2(0, -13) texture = ExtResource("1_ukwcc") hframes = 20 -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -reset_on_save = false -libraries = { -"": SubResource("AnimationLibrary_prr1g") -} - [node name="AnimationTree" type="AnimationTree" parent="."] libraries = { "": SubResource("AnimationLibrary_prr1g") @@ -2063,6 +2057,12 @@ parameters/melee/1/blend_position = Vector2(-0.218698, 0.0434783) parameters/melee/2/blend_position = Vector2(0, 0) parameters/walk/blend_position = Vector2(-0.0100167, -0.0729166) +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +reset_on_save = false +libraries = { +"": SubResource("AnimationLibrary_prr1g") +} + [node name="Hitbox" type="Area2D" parent="."] position = Vector2(0, 1) collision_layer = 2 diff --git a/Scripts/hiro_player.gd b/Scripts/hiro_player.gd index d5c1331..446f9e8 100644 --- a/Scripts/hiro_player.gd +++ b/Scripts/hiro_player.gd @@ -7,8 +7,8 @@ const FACING_ANGLE_EPSILON = 15 signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2) signal defeated -func _process(_delta): - if Input.is_action_pressed("melee") and $AnimationTree.get("parameters/conditions/melee") == false: +func _unhandled_input(event): + if event.is_action_pressed("melee") and $AnimationTree.get("parameters/conditions/melee") == false: var animation_rng = randf_range(0, 1) $AnimationTree.set("parameters/melee/blend_position", animation_rng) $AnimationTree.set("parameters/conditions/melee", true)