summaryrefslogtreecommitdiff
path: root/stage
diff options
context:
space:
mode:
Diffstat (limited to 'stage')
-rw-r--r--stage/dice_selection/dice_selection.gd7
-rw-r--r--stage/dice_selection/dice_selection.tscn1
-rw-r--r--stage/dice_selection/dice_selection_item.tscn53
-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
9 files changed, 41 insertions, 112 deletions
diff --git a/stage/dice_selection/dice_selection.gd b/stage/dice_selection/dice_selection.gd
index 812005a..b56bebe 100644
--- a/stage/dice_selection/dice_selection.gd
+++ b/stage/dice_selection/dice_selection.gd
@@ -29,6 +29,9 @@ func _ready() -> void:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("right_click"):
dice_selected.emit([] as Array[DiceConfiguration])
+
+ if event.is_action_pressed("menu"):
+ %GoButton.grab_focus()
func _on_deck_dice_selected(dice: Control) -> void:
@@ -61,10 +64,10 @@ func _on_dice_focus_entered(dice: Control) -> void:
var faces := [
dice_configuration.front_face,
dice_configuration.back_face,
- dice_configuration.top_face,
- dice_configuration.bottom_face,
dice_configuration.left_face,
dice_configuration.right_face,
+ dice_configuration.top_face,
+ dice_configuration.bottom_face,
]
%Label.text = ""
diff --git a/stage/dice_selection/dice_selection.tscn b/stage/dice_selection/dice_selection.tscn
index 934d3fc..1023cb9 100644
--- a/stage/dice_selection/dice_selection.tscn
+++ b/stage/dice_selection/dice_selection.tscn
@@ -50,6 +50,7 @@ unique_name_in_owner = true
layout_mode = 2
[node name="GoButton" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer" node_paths=PackedStringArray("shortcut_context")]
+unique_name_in_owner = true
layout_mode = 2
shortcut_context = NodePath(".")
shortcut = SubResource("Shortcut_sn5id")
diff --git a/stage/dice_selection/dice_selection_item.tscn b/stage/dice_selection/dice_selection_item.tscn
index 4cedb3e..8a51b96 100644
--- a/stage/dice_selection/dice_selection_item.tscn
+++ b/stage/dice_selection/dice_selection_item.tscn
@@ -1,56 +1,9 @@
-[gd_scene load_steps=13 format=3 uid="uid://d280t78wjw3hc"]
+[gd_scene load_steps=5 format=3 uid="uid://d280t78wjw3hc"]
[ext_resource type="Script" uid="uid://bgaq754eqfs8g" path="res://stage/dice_selection/dice_selection_item.gd" id="1_v6plq"]
[ext_resource type="Texture2D" uid="uid://blanietpri1be" path="res://icon.svg" id="2_1q4g0"]
[ext_resource type="Texture2D" uid="uid://db0v50mdroaox" path="res://stage/assets/isometric-tile.png" id="2_p1an8"]
-[ext_resource type="Script" uid="uid://dnklife8p0m35" path="res://stage/dice_throw/dice_face_configuration.gd" id="3_xogsa"]
-[ext_resource type="Script" uid="uid://6rit5abkk1rw" path="res://stage/dice_throw/dice_configuration.gd" id="4_p1an8"]
-
-[sub_resource type="Resource" id="Resource_xogsa"]
-script = ExtResource("3_xogsa")
-type = "move"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_ye5qu"]
-script = ExtResource("3_xogsa")
-type = "attack"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_xub8r"]
-script = ExtResource("3_xogsa")
-type = "move"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_0m3mt"]
-script = ExtResource("3_xogsa")
-type = "defend"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_inbll"]
-script = ExtResource("3_xogsa")
-type = "ability"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_p1an8"]
-script = ExtResource("3_xogsa")
-type = "attack"
-value = 1
-metadata/_custom_type_script = "uid://dnklife8p0m35"
-
-[sub_resource type="Resource" id="Resource_f5jvy"]
-script = ExtResource("4_p1an8")
-front_face = SubResource("Resource_xub8r")
-back_face = SubResource("Resource_xogsa")
-top_face = SubResource("Resource_p1an8")
-bottom_face = SubResource("Resource_ye5qu")
-left_face = SubResource("Resource_0m3mt")
-right_face = SubResource("Resource_inbll")
-metadata/_custom_type_script = "uid://6rit5abkk1rw"
+[ext_resource type="Resource" uid="uid://c5up64wq06lx1" path="res://dice_configuration.tres" id="4_xogsa"]
[node name="DiceSelectionItem" type="TextureButton"]
custom_minimum_size = Vector2(32, 32)
@@ -61,6 +14,6 @@ texture_focused = ExtResource("2_p1an8")
ignore_texture_size = true
stretch_mode = 4
script = ExtResource("1_v6plq")
-dice_configuration = SubResource("Resource_f5jvy")
+dice_configuration = ExtResource("4_xogsa")
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
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"]