Fixed input from controller
This commit is contained in:
@@ -27,22 +27,21 @@ func updateMovement(delta) -> void:
|
||||
if(dir.x != 0 or dir.y != 0):
|
||||
velocity.x = dir.x * speed * delta;
|
||||
velocity.z = dir.y * speed * delta;
|
||||
print(dir.length());
|
||||
|
||||
# Update direction
|
||||
if(dir.x > 0):
|
||||
if(
|
||||
dir.y == 0 or
|
||||
(dir.y < 0 and direction == Direction.SOUTH) or
|
||||
(dir.y > 0 and direction == Direction.NORTH)
|
||||
):
|
||||
direction = Direction.EAST;
|
||||
elif (dir.x < 0):
|
||||
if(
|
||||
dir.y == 0 or
|
||||
(dir.y < 0 and direction == Direction.SOUTH) or
|
||||
(dir.y > 0 and direction == Direction.NORTH)
|
||||
):
|
||||
direction = Direction.WEST;
|
||||
if(dir.x >= abs(dir.y) and(
|
||||
dir.y == 0 or
|
||||
(dir.y > 0 and direction != Direction.SOUTH) or
|
||||
(dir.y < 0 and direction != Direction.NORTH)
|
||||
)):
|
||||
direction = Direction.EAST;
|
||||
elif (dir.x <= -abs(dir.y) and (
|
||||
dir.y == 0 or
|
||||
(dir.y > 0 and direction != Direction.SOUTH) or
|
||||
(dir.y < 0 and direction != Direction.NORTH)
|
||||
)):
|
||||
direction = Direction.WEST;
|
||||
elif (dir.y > 0):
|
||||
direction = Direction.SOUTH;
|
||||
elif (dir.y < 0):
|
||||
|
Reference in New Issue
Block a user