From da7860f05f02965b8837d21814c2196ac24688f8 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Wed, 12 Oct 2022 08:38:28 -0400 Subject: [PATCH] SLAP! --- Player.gd | 26 ++++++++++++++------------ Player.tscn | 13 +++++++------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Player.gd b/Player.gd index 91e8bb8..4638469 100644 --- a/Player.gd +++ b/Player.gd @@ -115,6 +115,20 @@ func _physics_process(delta): else: isSlap = false; + if (chargeSlap): + slap += delta * 1.5; + else: + slap -= delta * 8.0; + slap = clamp(slap, 0.0, 1.0) + + slap_gauge.fill = slap + if !isSlap and can_slap: + slap_animator.seek(slap, true) + if isSlap: + slap_animator.playback_speed = 20 + slap_animator.play() + slap_gauge.fill = slap; + slap_gauge.kill = slapkill; if isSlap: if slap >= slapkill: @@ -126,18 +140,6 @@ func _physics_process(delta): hitbox.slap_level = slap hitbox.slap_kill = slapkill hitbox.slap_vector = point_to.get_global_transform().origin - camera.get_global_transform().origin - - if (chargeSlap): - slap += delta * 1.5; - else: - slap -= delta * 8.0; - slap = clamp(slap, 0.0, 1.0) - - slap_gauge.fill = slap - slap_animator.seek(slap, true) - slap_gauge.fill = slap; - slap_gauge.kill = slapkill; - direction = direction.normalized() diff --git a/Player.tscn b/Player.tscn index f456203..6af3023 100644 --- a/Player.tscn +++ b/Player.tscn @@ -69,6 +69,7 @@ tracks/2/keys = { [sub_resource type="Animation" id=6] resource_name = "basic_slap" +length = 3.0 tracks/0/type = "value" tracks/0/path = NodePath("Head/HandParent/Hand:translation") tracks/0/interp = 1 @@ -76,10 +77,10 @@ tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { -"times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), +"times": PoolRealArray( 0, 1, 2, 3 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), "update": 0, -"values": [ Vector3( 0, 0, 0 ), Vector3( -0.103, 2.756, 0 ) ] +"values": [ Vector3( 0, 0, 0 ), Vector3( -0.103, 2.756, 0 ), Vector3( -2, -5, 0 ), Vector3( 0, 0, 0 ) ] } tracks/1/type = "value" tracks/1/path = NodePath("Head/HandParent/Hand:rotation_degrees") @@ -88,10 +89,10 @@ tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { -"times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), +"times": PoolRealArray( 0, 1, 2, 3 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), "update": 0, -"values": [ Vector3( 0, 0, 0 ), Vector3( -36.146, -1.281, 0 ) ] +"values": [ Vector3( 0, 0, 0 ), Vector3( -36.146, -1.281, 0 ), Vector3( 90.146, -1.281, 0 ), Vector3( 0, 0, 0 ) ] } [node name="Player" type="KinematicBody"]