Skip to content
Snippets Groups Projects
Commit c61a4bbb authored by STAVRIDIS ADONIS's avatar STAVRIDIS ADONIS :speech_balloon:
Browse files

#116 last changes before merge

parent 3abc1a11
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@ extends Node
const GAMEPATH = "/root/game/"
const PORT = 10001
const MAX_CLIENTS = 2
const MAX_CLIENTS = 1
var players = {}
......
......@@ -149,7 +149,8 @@ func getPlayerInputs(movementInput:int, jumpId:int, attackTypeInput:int,
mouseX:int, mouseY:int):
# Prevent the player from moving when attacking
if (isAttacking):
motion = 0
if (is_on_floor()):
motion = 0
return
motion = movementInput
......@@ -159,20 +160,23 @@ mouseX:int, mouseY:int):
lastJumpId = jumpId
isJumping = true
# Execute attack
# Execute attack in direction
if (attackTypeInput != NONE):
attackDirection = MOUSE_UP
if (mouseX < 0 && mouseX <= mouseY):
attackDirection = MOUSE_LEFT
if (mouseX < 0):
bodyRotation = -1
set_rotation_degrees(Vector3(0, 180, 0))
broadcastTurn(bodyRotation)
elif (mouseX >= 0 && mouseX >= -mouseY):
attackDirection = MOUSE_RIGHT
else:
bodyRotation = 1
set_rotation_degrees(Vector3(0, 0, 0))
broadcastTurn(bodyRotation)
if (!is_on_floor() && mouseY > 0 && mouseX < mouseY && mouseX > -mouseY):
attackDirection = MOUSE_UP
if (mouseX < 0 && 1.5*mouseX <= mouseY):
attackDirection = MOUSE_LEFT
elif (mouseX >= 0 && 1.5*mouseX >= -mouseY):
attackDirection = MOUSE_RIGHT
if (!is_on_floor() && mouseY > 0 && 1.5*mouseX < mouseY
&& 1.5*mouseX > -mouseY):
attackDirection = MOUSE_DOWN
processAttack(attackTypeInput)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment