From 412e79e02ef024f58235dbd83bbd1c028d780ff8 Mon Sep 17 00:00:00 2001
From: Adonis Stavridis <adonis-ioannis.stavridis@etu.unistra.fr>
Date: Thu, 26 Mar 2020 12:47:43 +0100
Subject: [PATCH] #112 add jump kick side + bug fix

---
 server/entities/characters/player.gd | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/server/entities/characters/player.gd b/server/entities/characters/player.gd
index 2a3a6cf..fd33085 100644
--- a/server/entities/characters/player.gd
+++ b/server/entities/characters/player.gd
@@ -53,7 +53,8 @@ enum {
 	ID_PUNCH_1 = 0,
 	ID_PUNCH_2 = 1,
 	ID_KICK_1 = 2,
-	ID_KICK_2 = 3
+	ID_KICK_2 = 3,
+	ID_KICK_JUMP_SIDE = 4
 }
 var lastPunchId:int = 0     # Detect a new punch (of any type)
 var idleTime:float = 0      # Stun when hit + prevent spam
@@ -75,9 +76,11 @@ onready var kickHitArea:Area = $kickHitArea
 var kickAttackDmg:float = 10.0
 var kick1AttackDist:float = 1.7
 var kick2AttackDist:float = 1.4
+var kickJumpSideAttackDist:float = 1.2
 var kickAttackWait:float = 0.75
 var kick1AttackDuration:float = 0.2
 var kick2AttackDuration:float = 0.3
+var kickJumpSideAttackDuration:float = 0.3
 var kickAttackDirection:Vector3 = Vector3(1.2,1,0)
 var kickAttackStrength:float = 1
 
@@ -244,7 +247,7 @@ func processAttack(attackType:int):
 					attack(ID_PUNCH_2)
 			else:
 				broadcastAnimation(ANIM_JUMP_KICK_SIDE)
-				attack(ID_KICK_1)
+				attack(ID_KICK_JUMP_SIDE)
 		KICK:
 			if self.is_on_floor():
 				if (!animSequence):
@@ -255,6 +258,9 @@ func processAttack(attackType:int):
 					broadcastAnimation(ANIM_KICK_2)
 					animSequence = 0
 					attack(ID_KICK_2)
+			else:
+				broadcastAnimation(ANIM_JUMP_KICK_SIDE)
+				attack(ID_KICK_JUMP_SIDE)
 
 
 func attack(idAttack:int):
@@ -277,9 +283,12 @@ func attack(idAttack:int):
 		if (idAttack == ID_KICK_1):
 			distance = kick1AttackDist
 			duration = kick1AttackDuration
-		else:
+		elif (idAttack == ID_KICK_2):
 			distance = kick2AttackDist
 			duration = kick2AttackDuration
+		else:
+			distance = kickJumpSideAttackDist
+			duration = kickJumpSideAttackDuration
 	
 	# Set active the hitbox of the attack, its visual feedback on server
 	hitArea.set_monitoring(true)
-- 
GitLab