diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-23 20:05:28 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 20:05:28 +0200 | 
| commit | 3885cbfae528608350804f704dba9c82fdbfd027 (patch) | |
| tree | 384a37820cf43d1868493600a8e0566c78b9ab4a /client/scripts/player.gd | |
| parent | 93221433e704e1c98cc84c55caefddb85c2d5717 (diff) | |
| download | hurrycurry-3885cbfae528608350804f704dba9c82fdbfd027.tar hurrycurry-3885cbfae528608350804f704dba9c82fdbfd027.tar.bz2 hurrycurry-3885cbfae528608350804f704dba9c82fdbfd027.tar.zst | |
move files around
Diffstat (limited to 'client/scripts/player.gd')
| -rw-r--r-- | client/scripts/player.gd | 81 | 
1 files changed, 0 insertions, 81 deletions
| diff --git a/client/scripts/player.gd b/client/scripts/player.gd deleted file mode 100644 index 423855e9..00000000 --- a/client/scripts/player.gd +++ /dev/null @@ -1,81 +0,0 @@ -# Undercooked - a game about cooking -# Copyright 2024 nokoe -# Copyright 2024 metamuffin -# Copyright 2024 tpart -#  -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, version 3 of the License only. -#  -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -# GNU Affero General Public License for more details. -#  -# You should have received a copy of the GNU Affero General Public License -# along with this program.  If not, see <https://www.gnu.org/licenses/>. -#  -class_name Player -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() - -var hand: Node3D = null - -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 -	game = new_game - -func update_position(new_position: Vector2, new_rotation: float): -	position_ = new_position -	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: -		push_error("already holding an item") -	var i = tile.take_item() -	if i == null: -		push_error("tile is null") -	hand = i - -func put_item(tile: Floor): -	var i = remove_item() -	tile.put_item(i) - -func _process(delta): -	_anim_angle = fmod(_anim_angle + delta, TAU) -	hand_base.position.y = HAND_BASE_POSITION.y + 0.05 * sin(_anim_angle * 3) -	position_anim = lerp(position_anim, position_, delta * 10) -	rotation_anim = lerp_angle(rotation_anim, rotation_, delta * 10) -	position.x = position_anim.x -	position.z = position_anim.y -	rotation.y = rotation_anim | 
