diff --git a/client/levels/test/game.gd b/client/levels/test/game.gd index 1bf1493611374c2f5c41372f3eed044ee79941c2..68e7f5644be8ade24069f647929dd9d72d493f07 100644 --- a/client/levels/test/game.gd +++ b/client/levels/test/game.gd @@ -2,7 +2,6 @@ extends Node # Movements var movementInput:int = 0 -var jumpInput:bool = false # Know if the player wants to jump var jumpId:int = 0 # Distinguish 2 different jumps var mouseX:int = 0 # Mouse X percentage var mouseY:int = 0 # Mouse Y percentage @@ -31,10 +30,6 @@ func getPlayerInput(): if Input.is_action_just_pressed("movementJump"): jumpId += 1 - if Input.is_action_pressed("movementJump"): - jumpInput = true - else: - jumpInput = false if Input.is_action_pressed("primaryAttack"): attackStateInput = PUNCH @@ -46,7 +41,7 @@ func getPlayerInput(): mouseY = int(mousePosition.y/vpSize.y * 100) - 50 # Sent without safety resend - rpc_unreliable_id(1, "sendPlayerInputs", movementInput, jumpInput, jumpId, + rpc_unreliable_id(1, "sendPlayerInputs", movementInput, jumpId, attackStateInput, mouseX, mouseY) diff --git a/server/entities/characters/Class1/class1.gd b/server/entities/characters/Class1/class1.gd index 056b0051516876400a570c2168d7bb8a22b9aba9..b0de48a7075c7c9dd66cc6d854a0737c349172c4 100644 --- a/server/entities/characters/Class1/class1.gd +++ b/server/entities/characters/Class1/class1.gd @@ -3,7 +3,7 @@ extends "res://entities/characters/player.gd" # Called when the node enters the scene tree for the first time. func _ready(): # Modification for this character - maxJump = 3 + maxJump = 2 # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/server/entities/characters/player.gd b/server/entities/characters/player.gd index 1e18792a36becfaf0641538a78a7255e46646da8..fce0783f1b37b213d9f0ddb6f593dbd3a08d47ce 100644 --- a/server/entities/characters/player.gd +++ b/server/entities/characters/player.gd @@ -126,21 +126,17 @@ func _physics_process(delta:float): # Called from the game script to update the vars -func getPlayerInputs(movementInput:int, jumpInput:bool, jumpId:int, -attackTypeInput:int, mouseX:int, mouseY:int): - motion = 0 +func getPlayerInputs(movementInput:int, jumpId:int, attackTypeInput:int, mouseX:int, mouseY:int): # Prevent the player from moving when attacking if isAttacking: return motion = movementInput - isJumping = false # Differentiate a new jump from a reemitted one if lastJumpId != jumpId: lastJumpId = jumpId - if jumpInput: - isJumping = true + isJumping = true # Execute attack if attackTypeInput != NONE: @@ -192,13 +188,13 @@ func processMovement(delta:float): currentJump = 0 # Reset the last striker lastStrikerId = ownId - elif currentJump == 0 && !isJumping: # Initial jump prevented currentJump = 1 # Jump attempts computation if isJumping: + isJumping = false if currentJump < maxJump: broadcastAnimation(ANIM_JUMP) currentJump += 1 diff --git a/server/levels/test/game.gd b/server/levels/test/game.gd index d2b18e60027445d4913eac8f9cb7257b82c7f063..17b8eab57d7770de7bad6cb7a79e17e5aa864c21 100644 --- a/server/levels/test/game.gd +++ b/server/levels/test/game.gd @@ -1,12 +1,11 @@ extends Node -master func sendPlayerInputs(movementInput:int, jumpInput:bool, jumpId:int, -attackStateInput:int, mouseX:int, mouseY:int): +master func sendPlayerInputs(movementInput:int, jumpId:int, attackStateInput:int, mouseX:int, mouseY:int): # Get the input from a client and send it to the matching remote player var senderId:int = get_tree().get_rpc_sender_id() if gamestate.players.has(senderId): gamestate.get_node("/root/game/"+str(senderId)).getPlayerInputs(movementInput, - jumpInput, jumpId, attackStateInput, mouseX, mouseY) + jumpId, attackStateInput, mouseX, mouseY) # When the player exits the game area