aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/scenes/main_menu.tscn1
-rw-r--r--client/scenes/player.tscn8
-rw-r--r--client/scripts/character.gd13
-rw-r--r--client/scripts/mirror.gd16
-rw-r--r--client/scripts/player.gd25
5 files changed, 56 insertions, 7 deletions
diff --git a/client/scenes/main_menu.tscn b/client/scenes/main_menu.tscn
index e1c3475d..ea9b31fb 100644
--- a/client/scenes/main_menu.tscn
+++ b/client/scenes/main_menu.tscn
@@ -80,7 +80,6 @@ alignment = 0
[node name="SceneTransition" parent="." instance=ExtResource("5_651nk")]
layout_mode = 1
-color = Color(0, 0, 0, 1)
[connection signal="pressed" from="side/options/quick_connect" to="." method="_on_quick_connect_pressed"]
[connection signal="pressed" from="side/options/connect/connect" to="." method="_on_connect_pressed"]
diff --git a/client/scenes/player.tscn b/client/scenes/player.tscn
index a0ca9251..9c633575 100644
--- a/client/scenes/player.tscn
+++ b/client/scenes/player.tscn
@@ -1,15 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://d30bj2cp1m7gd"]
-[ext_resource type="PackedScene" uid="uid://b6m4wnlgfsbwp" path="res://models/glb/guy.glb" id="1_8t728"]
+[ext_resource type="PackedScene" uid="uid://b3hhir2fvnunu" path="res://models/prefabs/characters/guy.tscn" id="1_g5ma4"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_4w71x"]
[node name="Player" type="Node3D"]
-[node name="guy" parent="." instance=ExtResource("1_8t728")]
-transform = Transform3D(0.35, 0, -6.59029e-14, 0, 0.35, 0, 6.59029e-14, 0, 0.35, 0, 0, 0)
-
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.5, 0)
visible = false
mesh = SubResource("CapsuleMesh_4w71x")
+
+[node name="Character" parent="." instance=ExtResource("1_g5ma4")]
+transform = Transform3D(0.33, 0, 0, 0, 0.33, 0, 0, 0, 0.33, 0, 0, 0)
diff --git a/client/scripts/character.gd b/client/scripts/character.gd
new file mode 100644
index 00000000..0340595a
--- /dev/null
+++ b/client/scripts/character.gd
@@ -0,0 +1,13 @@
+extends Node3D
+class_name Character
+
+@onready var hand_animations = $HandAnimations
+
+func _ready():
+ play_animation("idle")
+
+func play_animation(name_: String):
+ hand_animations.play(name_)
+
+func _on_hand_animations_animation_finished(name_):
+ hand_animations.play(name_)
diff --git a/client/scripts/mirror.gd b/client/scripts/mirror.gd
new file mode 100644
index 00000000..a5cb9c59
--- /dev/null
+++ b/client/scripts/mirror.gd
@@ -0,0 +1,16 @@
+@tool
+
+# Hand mirror helper script, useful for animating characters
+
+extends Node3D
+
+@export var enabled := true
+
+@onready var hand_right = $Main/HandRight
+@onready var hand_left = $Main/HandLeft
+
+
+func _process(delta):
+ if enabled:
+ hand_right.position = hand_left.position * Vector3(-1,1,1)
+ hand_right.rotation = hand_left.rotation * Vector3(1, -1, -1) - Vector3(0.2 * PI, 0, 0)
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: