diff options
Diffstat (limited to 'stage/dice_throw')
-rw-r--r-- | stage/dice_throw/dice.tscn | 9 | ||||
-rw-r--r-- | stage/dice_throw/dice_face.gd | 5 | ||||
-rw-r--r-- | stage/dice_throw/dice_face.gd.uid | 1 | ||||
-rw-r--r-- | stage/dice_throw/dice_face.tscn | 6 | ||||
-rw-r--r-- | stage/dice_throw/dice_throw.gd | 6 |
5 files changed, 23 insertions, 4 deletions
diff --git a/stage/dice_throw/dice.tscn b/stage/dice_throw/dice.tscn index 75fb93c..38f13d0 100644 --- a/stage/dice_throw/dice.tscn +++ b/stage/dice_throw/dice.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=12 format=3 uid="uid://dnq7fpof6w0mj"] +[gd_scene load_steps=13 format=3 uid="uid://dnq7fpof6w0mj"] [ext_resource type="Script" uid="uid://bajtxq3ucs8f4" path="res://stage/dice_throw/dice.gd" id="1_gwnix"] [ext_resource type="Texture2D" uid="uid://blanietpri1be" path="res://icon.svg" id="2_6tbdd"] +[ext_resource type="PackedScene" uid="uid://y1hkmpd41rrq" path="res://stage/dice_throw/dice_face.tscn" id="2_ee854"] [ext_resource type="Texture2D" uid="uid://dtltt171temec" path="res://stage/assets/tinyBlocks.png" id="3_t0umq"] [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_m7tx2"] @@ -44,11 +45,11 @@ shape = SubResource("BoxShape3D_tqijt") [node name="Faces" type="Node3D" parent="."] -[node name="Sprite3D" type="Sprite3D" parent="Faces"] +[node name="DiceFace" parent="Faces" instance=ExtResource("2_ee854")] transform = Transform3D(0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0, 0, 0.51) texture = ExtResource("2_6tbdd") -metadata/up = Vector3(-90, 0, 0) -metadata/type = "move" +up_rotation = Vector3(-90, 0, 0) +type = "move" [node name="Sprite3D2" type="Sprite3D" parent="Faces"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.51) diff --git a/stage/dice_throw/dice_face.gd b/stage/dice_throw/dice_face.gd new file mode 100644 index 0000000..6403a4c --- /dev/null +++ b/stage/dice_throw/dice_face.gd @@ -0,0 +1,5 @@ +extends Sprite3D + + +@export var up_rotation: Vector3 +@export var type: String diff --git a/stage/dice_throw/dice_face.gd.uid b/stage/dice_throw/dice_face.gd.uid new file mode 100644 index 0000000..785acfa --- /dev/null +++ b/stage/dice_throw/dice_face.gd.uid @@ -0,0 +1 @@ +uid://qvqdbngedxd3 diff --git a/stage/dice_throw/dice_face.tscn b/stage/dice_throw/dice_face.tscn new file mode 100644 index 0000000..913b133 --- /dev/null +++ b/stage/dice_throw/dice_face.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://y1hkmpd41rrq"] + +[ext_resource type="Script" uid="uid://qvqdbngedxd3" path="res://stage/dice_throw/dice_face.gd" id="1_63pm6"] + +[node name="DiceFace" type="Sprite3D"] +script = ExtResource("1_63pm6") diff --git a/stage/dice_throw/dice_throw.gd b/stage/dice_throw/dice_throw.gd index e612dc2..d06a8f7 100644 --- a/stage/dice_throw/dice_throw.gd +++ b/stage/dice_throw/dice_throw.gd @@ -6,6 +6,8 @@ signal throw_finished func _ready() -> void: %Side.position.x = -%Side.size.x + + %move.text = "Move: %s" % str(Network.current_player.current_move_points) func _on_dice_throw_3d_throw_finished() -> void: @@ -61,6 +63,10 @@ func _on_dice_throw_3d_throw_finished() -> void: var p3d = %Camera3D.project_position(node.position + node.size * 0.5, 1) tween.tween_property(dice, "position", p3d, 0.25) tween.tween_property(dice, "scale", Vector3(0.1, 0.1, 0.1), 0.25) + + if top_faces[idx].get_meta("type") == "move": + Network.current_player.set_current_move_points(Network.current_player.current_move_points + 1) + %move.text = "Move: %s" % str(Network.current_player.current_move_points) await tween.finished for dice in dices: |