diff options
Diffstat (limited to 'client/player/player.gd')
| -rw-r--r-- | client/player/player.gd | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/client/player/player.gd b/client/player/player.gd index 423855e9..b8982aa7 100644 --- a/client/player/player.gd +++ b/client/player/player.gd @@ -22,11 +22,15 @@ const PLAYER_SIZE: float = 0.4 const SPEED: float = 25. var game: Game +var rotation_ = 0. +var rotation_anim = 0. var position_ = Vector2(0, 0) +var position_anim = Vector2(0, 0) -var mesh = preload("res://scenes/player.tscn").instantiate() +var mesh = preload("res://player/player.tscn").instantiate() -var hand: Node3D = null +var hand: Item = null +var hand_base: Node3D = Node3D.new() var _anim_angle: float = 0.0 @@ -40,6 +44,9 @@ func _init(_id: int, new_name: String, pos: Vector2, _character: int, new_game: name = new_name game = new_game + hand_base.position = HAND_BASE_POSITION + add_child(hand_base) + func update_position(new_position: Vector2, new_rotation: float): position_ = new_position rotation_ = new_rotation @@ -63,9 +70,7 @@ func take_item(tile: Floor): if hand != null: push_error("already holding an item") var i = tile.take_item() - if i == null: - push_error("tile is null") - hand = i + set_item(i) func put_item(tile: Floor): var i = remove_item() |