summaryrefslogtreecommitdiff
path: root/stage/dice_throw
diff options
context:
space:
mode:
Diffstat (limited to 'stage/dice_throw')
-rw-r--r--stage/dice_throw/dice.tscn53
-rw-r--r--stage/dice_throw/dice_configuration.gd4
-rw-r--r--stage/dice_throw/dice_face.gd15
-rw-r--r--stage/dice_throw/dice_face_configuration.gd2
-rw-r--r--stage/dice_throw/dice_throw.gd14
-rw-r--r--stage/dice_throw/dice_throw.tscn4
6 files changed, 32 insertions, 60 deletions
diff --git a/stage/dice_throw/dice.tscn b/stage/dice_throw/dice.tscn
index 5834cfb..6a8697d 100644
--- a/stage/dice_throw/dice.tscn
+++ b/stage/dice_throw/dice.tscn
@@ -1,61 +1,14 @@
-[gd_scene load_steps=22 format=3 uid="uid://dnq7fpof6w0mj"]
+[gd_scene load_steps=14 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="Script" uid="uid://dnklife8p0m35" path="res://stage/dice_throw/dice_face_configuration.gd" id="2_6vba1"]
[ext_resource type="PackedScene" uid="uid://y1hkmpd41rrq" path="res://stage/dice_throw/dice_face.tscn" id="2_ee854"]
-[ext_resource type="Script" uid="uid://6rit5abkk1rw" path="res://stage/dice_throw/dice_configuration.gd" id="3_juxel"]
+[ext_resource type="Resource" uid="uid://c5up64wq06lx1" path="res://dice_configuration.tres" id="2_m3bw3"]
[ext_resource type="Texture2D" uid="uid://dtltt171temec" path="res://stage/assets/tinyBlocks.png" id="3_t0umq"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_m7tx2"]
bounce = 0.5
-[sub_resource type="Resource" id="Resource_arxo3"]
-script = ExtResource("2_6vba1")
-type = "move"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_ms37x"]
-script = ExtResource("2_6vba1")
-type = "attack"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_tk6el"]
-script = ExtResource("2_6vba1")
-type = "move"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_l28ne"]
-script = ExtResource("2_6vba1")
-type = "defend"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_eguj2"]
-script = ExtResource("2_6vba1")
-type = "ability"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_c3r23"]
-script = ExtResource("2_6vba1")
-type = "attack"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_inr58"]
-script = ExtResource("3_juxel")
-front_face = SubResource("Resource_tk6el")
-back_face = SubResource("Resource_arxo3")
-top_face = SubResource("Resource_c3r23")
-bottom_face = SubResource("Resource_ms37x")
-left_face = SubResource("Resource_l28ne")
-right_face = SubResource("Resource_eguj2")
-metadata/_custom_type_script = "uid://6rit5abkk1rw"
-
[sub_resource type="BoxMesh" id="BoxMesh_gof22"]
[sub_resource type="BoxShape3D" id="BoxShape3D_tqijt"]
@@ -84,7 +37,7 @@ region = Rect2(72, 144, 18, 18)
physics_material_override = SubResource("PhysicsMaterial_m7tx2")
gravity_scale = 2.0
script = ExtResource("1_gwnix")
-configuration = SubResource("Resource_inr58")
+configuration = ExtResource("2_m3bw3")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_gof22")
diff --git a/stage/dice_throw/dice_configuration.gd b/stage/dice_throw/dice_configuration.gd
index 48a7d22..a4fef90 100644
--- a/stage/dice_throw/dice_configuration.gd
+++ b/stage/dice_throw/dice_configuration.gd
@@ -4,7 +4,7 @@ extends Resource
@export var front_face: DiceFaceConfiguration
@export var back_face: DiceFaceConfiguration
-@export var top_face: DiceFaceConfiguration
-@export var bottom_face: DiceFaceConfiguration
@export var left_face: DiceFaceConfiguration
@export var right_face: DiceFaceConfiguration
+@export var top_face: DiceFaceConfiguration
+@export var bottom_face: DiceFaceConfiguration
diff --git a/stage/dice_throw/dice_face.gd b/stage/dice_throw/dice_face.gd
index f314a3f..71d40ae 100644
--- a/stage/dice_throw/dice_face.gd
+++ b/stage/dice_throw/dice_face.gd
@@ -4,3 +4,18 @@ extends Sprite3D
@export var up_rotation: Vector3
@export var configuration: DiceFaceConfiguration
+
+
+static func get_face_type_icon(type: Game.FaceType) -> ImageTexture:
+ if type == Game.FaceType.MOVE:
+ return load("res://ui/assets/face_type_move.png")
+ elif type == Game.FaceType.ATTACK:
+ return load("res://ui/assets/face_type_attack.png")
+ elif type == Game.FaceType.DEFEND:
+ return load("res://ui/assets/face_type_defend.png")
+ elif type == Game.FaceType.ABILITY:
+ return load("res://ui/assets/face_type_ability.png")
+ elif type == Game.FaceType.ENTITY:
+ return load("res://ui/assets/face_type_entity.png")
+
+ return null
diff --git a/stage/dice_throw/dice_face_configuration.gd b/stage/dice_throw/dice_face_configuration.gd
index e75dd90..fd28d3e 100644
--- a/stage/dice_throw/dice_face_configuration.gd
+++ b/stage/dice_throw/dice_face_configuration.gd
@@ -2,5 +2,5 @@ class_name DiceFaceConfiguration
extends Resource
-@export var type: String
+@export var type: Game.FaceType
@export var value: int
diff --git a/stage/dice_throw/dice_throw.gd b/stage/dice_throw/dice_throw.gd
index d6bdc34..1e80f64 100644
--- a/stage/dice_throw/dice_throw.gd
+++ b/stage/dice_throw/dice_throw.gd
@@ -78,24 +78,28 @@ func _on_dice_throw_3d_throw_finished(thrown_dices: Array[Dice]) -> void:
for idx in thrown_dices.size():
var dice := thrown_dices[idx]
var top_face := top_faces[idx]
- var node := get_node("%" + top_face.configuration.type)
+
+ if top_face.configuration.type == Game.FaceType.ENTITY:
+ continue # skip for now
+
+ var node := get_node("%" + Game.FaceType.keys()[top_face.configuration.type].to_lower())
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_face.configuration.type == "move":
+ if top_face.configuration.type == Game.FaceType.MOVE:
#Network.current_player.set_current_move_points(Network.current_player.current_move_points + 1)
Network.current_player.current_move_points += top_face.configuration.value
%move.text = "Move: %s" % str(Network.current_player.current_move_points)
- elif top_face.configuration.type == "attack":
+ elif top_face.configuration.type == Game.FaceType.ATTACK:
#Network.current_player.set_current_attack_points(Network.current_player.current_attack_points + 1)
Network.current_player.current_attack_points += top_face.configuration.value
%attack.text = "Attack: %s" % str(Network.current_player.current_attack_points)
- elif top_face.configuration.type == "defend":
+ elif top_face.configuration.type == Game.FaceType.DEFEND:
#Network.current_player.set_current_defend_points(Network.current_player.current_defend_points + 1)
Network.current_player.current_defend_points += top_face.configuration.value
%defend.text = "Defend: %s" % str(Network.current_player.current_defend_points)
- elif top_face.configuration.type == "ability":
+ elif top_face.configuration.type == Game.FaceType.ABILITY:
#Network.current_player.set_current_ability_points(Network.current_player.current_ability_points + 1)
Network.current_player.current_ability_points += top_face.configuration.value
%ability.text = "Ability: %s" % str(Network.current_player.current_ability_points)
diff --git a/stage/dice_throw/dice_throw.tscn b/stage/dice_throw/dice_throw.tscn
index 286dca4..afbcc85 100644
--- a/stage/dice_throw/dice_throw.tscn
+++ b/stage/dice_throw/dice_throw.tscn
@@ -7,12 +7,12 @@
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
-[sub_resource type="Sky" id="Sky_ij08j"]
+[sub_resource type="Sky" id="Sky_kn6vl"]
sky_material = SubResource("ProceduralSkyMaterial_cqep4")
[sub_resource type="Environment" id="Environment_sn6lt"]
background_mode = 2
-sky = SubResource("Sky_ij08j")
+sky = SubResource("Sky_kn6vl")
tonemap_mode = 2
[node name="DiceThrow" type="Control"]