Improved network communication
This commit is contained in:
22
client/player/controller/PlayerController.gd
Normal file
22
client/player/controller/PlayerController.gd
Normal file
@ -0,0 +1,22 @@
|
||||
class_name PlayerController
|
||||
extends Node
|
||||
|
||||
## The character that we're controlling.
|
||||
@export var character: Character
|
||||
|
||||
var move: Vector2
|
||||
|
||||
func _input(_event):
|
||||
move = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
|
||||
character.direction = (Global.camera.transform.basis * Vector3(move.x, 0, move.y))
|
||||
character.direction.y = 0
|
||||
character.direction = character.direction.normalized()
|
||||
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
character.jump()
|
||||
|
||||
if Input.is_action_just_pressed("dash"):
|
||||
character.dash()
|
||||
|
||||
if Input.is_action_just_pressed("attack"):
|
||||
character.attack()
|
Reference in New Issue
Block a user