diff options
| author | tpart <tpart120@proton.me> | 2024-06-23 14:28:46 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:32:56 +0200 | 
| commit | 50ea7e15d0a6185d9114cf9ac8337c3558334fd4 (patch) | |
| tree | 055d5c82897ddb418a0230e2e102c56c4af666e8 /client/scripts/player.gd | |
| parent | 85e478653a308d05884db8a0c69ac2d0dcda21eb (diff) | |
| download | hurrycurry-50ea7e15d0a6185d9114cf9ac8337c3558334fd4.tar hurrycurry-50ea7e15d0a6185d9114cf9ac8337c3558334fd4.tar.bz2 hurrycurry-50ea7e15d0a6185d9114cf9ac8337c3558334fd4.tar.zst | |
Add character hand animations
Diffstat (limited to 'client/scripts/player.gd')
| -rw-r--r-- | client/scripts/player.gd | 25 | 
1 files changed, 23 insertions, 2 deletions
| diff --git a/client/scripts/player.gd b/client/scripts/player.gd index a304fe29..796a1480 100644 --- a/client/scripts/player.gd +++ b/client/scripts/player.gd @@ -11,7 +11,13 @@ var mesh = preload("res://scenes/player.tscn").instantiate()  var hand: Node3D = null -func _init(id: int, new_name: String, pos: Vector2, _character: int): +var _anim_angle: float = 0.0 + +const HAND_BASE_POSITION: Vector3 = Vector3(0, .25, .4) + +@onready var character: Character = $Player/Character + +func _init(_id: int, new_name: String, pos: Vector2, _character: int, new_game: Game):  	add_child(mesh)  	position_ = pos  	name = new_name @@ -19,7 +25,22 @@ func _init(id: int, new_name: String, pos: Vector2, _character: int):  func update_position(new_position: Vector2, new_rotation: float):  	position_ = new_position -	rotation.y = new_rotation +	rotation_ = new_rotation + +func set_item(i: Item): +	i.owned_by = hand_base +	if i == null: +		push_error("tile is null") +	hand = i +	character.play_animation("hold") + +func remove_item() -> Item: +	var i = hand +	if i == null: +		push_error("holding nothing") +	hand = null +	character.play_animation("idle") +	return i  func take_item(tile: Floor):  	if hand != null: | 
