diff options
Diffstat (limited to 'client/scripts/player.gd')
-rw-r--r-- | client/scripts/player.gd | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/client/scripts/player.gd b/client/scripts/player.gd index 3ad77322..8f53b790 100644 --- a/client/scripts/player.gd +++ b/client/scripts/player.gd @@ -4,13 +4,21 @@ extends Node3D const PLAYER_SIZE: float = 0.4 const SPEED: float = 25. +var game: Game +var position_ = Vector2(0, 0) + var mesh = preload("res://scenes/player.tscn").instantiate() -func _init(id: int, new_name: String, pos: Vector2, _character: int): +func _init(id: int, new_name: String, pos: Vector2, _character: int, new_game: Game): add_child(mesh) - position = Vector3(pos.x, 0, pos.y) + position_ = pos name = new_name + game = new_game func update_position(new_position: Vector2, new_rotation: float): - position = Vector3(new_position.x, 0, new_position.y) + position_ = new_position rotation.y = new_rotation + +func _process(delta): + position.x = position_.x + position.z = position_.y |