Started to add mvp functionality
This commit is contained in:
parent
ce3b8c3568
commit
dfcc626b4c
15 changed files with 198 additions and 2 deletions
3
Globals/player_data.gd
Normal file
3
Globals/player_data.gd
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
extends Node
|
||||
|
||||
var die_inventory: Array[DieData]
|
||||
1
Globals/player_data.gd.uid
Normal file
1
Globals/player_data.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://btw1rdth3dily
|
||||
9
Resources/Dies/default_die.tres
Normal file
9
Resources/Dies/default_die.tres
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="Resource" script_class="DieData" format=3 uid="uid://c8l1o5q7jvlc7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://p6yd34plywsk" path="res://Resources/die_data.gd" id="1_kgj8p"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_kgj8p")
|
||||
die_name = "Default"
|
||||
die_size = 6
|
||||
metadata/_custom_type_script = "uid://p6yd34plywsk"
|
||||
15
Resources/die_data.gd
Normal file
15
Resources/die_data.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class_name DieData
|
||||
extends Resource
|
||||
|
||||
var die_faces: Array[int] = []
|
||||
|
||||
@export var die_name: String
|
||||
@export var die_size: int:
|
||||
set(new_size):
|
||||
die_size = new_size
|
||||
update_faces()
|
||||
|
||||
func update_faces() -> void:
|
||||
die_faces.clear()
|
||||
for i in range(1, die_size + 1):
|
||||
die_faces.append(i)
|
||||
1
Resources/die_data.gd.uid
Normal file
1
Resources/die_data.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://p6yd34plywsk
|
||||
38
Scenes/Battle/attack_card.tscn
Normal file
38
Scenes/Battle/attack_card.tscn
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
[gd_scene format=3 uid="uid://bikd5ukvohh5y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://r48cvc2v21kg" path="res://attack_card.gd" id="1_tbh35"]
|
||||
|
||||
[node name="AttackCard" type="Panel" unique_id=2051834154]
|
||||
custom_maximum_size = Vector2(400, 200)
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_tbh35")
|
||||
|
||||
[node name="Labels" type="VBoxContainer" parent="." unique_id=2138569391]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Damage" type="Label" parent="Labels" unique_id=409743516]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Damage: ##"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DiceName" type="Label" parent="Labels" unique_id=289063252]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Dice name: ###"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DiceFaces" type="Label" parent="Labels" unique_id=1570645889]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Total faces: ##"
|
||||
vertical_alignment = 1
|
||||
17
Scenes/Battle/battle_scene.gd
Normal file
17
Scenes/Battle/battle_scene.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Control
|
||||
|
||||
@export var test_die: DieData
|
||||
|
||||
const DICE = preload("uid://bt42roinpuaqy")
|
||||
|
||||
var new_dice: Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
new_dice = DICE.instantiate()
|
||||
add_child(new_dice)
|
||||
new_dice.initialize_dice(test_die)
|
||||
|
||||
|
||||
func _on_roll_dice_pressed() -> void:
|
||||
new_dice.roll_dice.emit()
|
||||
1
Scenes/Battle/battle_scene.gd.uid
Normal file
1
Scenes/Battle/battle_scene.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://t1oraavj6jpk
|
||||
40
Scenes/Battle/battle_scene.tscn
Normal file
40
Scenes/Battle/battle_scene.tscn
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[gd_scene format=3 uid="uid://pfl6jxwdjafp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://t1oraavj6jpk" path="res://Scenes/Battle/battle_scene.gd" id="1_yw7yn"]
|
||||
[ext_resource type="Resource" uid="uid://c8l1o5q7jvlc7" path="res://Resources/Dies/default_die.tres" id="2_owr4d"]
|
||||
[ext_resource type="PackedScene" uid="uid://bikd5ukvohh5y" path="res://Scenes/Battle/attack_card.tscn" id="3_c3aki"]
|
||||
|
||||
[node name="BattleScene" type="Control" unique_id=1237978529]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_yw7yn")
|
||||
test_die = ExtResource("2_owr4d")
|
||||
|
||||
[node name="RollDice" type="Button" parent="." unique_id=993526403]
|
||||
custom_minimum_size = Vector2(400, 200)
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -200.0
|
||||
offset_top = -200.0
|
||||
offset_right = 200.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_font_sizes/font_size = 90
|
||||
text = "Roll Dice"
|
||||
|
||||
[node name="AttackCard" parent="." unique_id=2051834154 instance=ExtResource("3_c3aki")]
|
||||
layout_mode = 1
|
||||
offset_left = 186.0
|
||||
offset_top = 818.0
|
||||
offset_right = -1334.0
|
||||
offset_bottom = -62.0
|
||||
|
||||
[connection signal="pressed" from="RollDice" to="." method="_on_roll_dice_pressed"]
|
||||
17
Scenes/Dice/dice.gd
Normal file
17
Scenes/Dice/dice.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Control
|
||||
|
||||
signal roll_dice
|
||||
|
||||
var die_data: DieData
|
||||
@onready var dice_roll: Label = $Background/DiceRoll
|
||||
|
||||
func _ready() -> void:
|
||||
roll_dice.connect(_on_roll_dice)
|
||||
|
||||
func initialize_dice(data: DieData) -> void:
|
||||
die_data = data
|
||||
dice_roll.text = str(0)
|
||||
|
||||
func _on_roll_dice() -> void:
|
||||
var face = die_data.die_faces.pick_random()
|
||||
dice_roll.text = str(face)
|
||||
1
Scenes/Dice/dice.gd.uid
Normal file
1
Scenes/Dice/dice.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://5atyp2xyf04j
|
||||
23
Scenes/Dice/dice.tscn
Normal file
23
Scenes/Dice/dice.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene format=3 uid="uid://bt42roinpuaqy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5atyp2xyf04j" path="res://Scenes/Dice/dice.gd" id="1_nyboh"]
|
||||
|
||||
[node name="Dice" type="Control" unique_id=960143251]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_nyboh")
|
||||
|
||||
[node name="Background" type="Panel" parent="." unique_id=1503072774]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="DiceRoll" type="Label" parent="Background" unique_id=199352863]
|
||||
layout_mode = 0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 200.0
|
||||
theme_override_font_sizes/font_size = 100
|
||||
text = "##"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
11
attack_card.gd
Normal file
11
attack_card.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends Control
|
||||
|
||||
@onready var damage: Label = $Labels/Damage
|
||||
@onready var dice_name: Label = $Labels/DiceName
|
||||
@onready var dice_faces: Label = $Labels/DiceFaces
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
damage.text = 'Damage: ##'
|
||||
dice_name.text = 'Dice name: ##'
|
||||
dice_faces.text = 'Total faces: ##'
|
||||
1
attack_card.gd.uid
Normal file
1
attack_card.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://r48cvc2v21kg
|
||||
|
|
@ -1,8 +1,26 @@
|
|||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="dice_delves"
|
||||
run/main_scene="uid://pfl6jxwdjafp"
|
||||
config/features=PackedStringArray("4.7")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[rendering]
|
||||
[autoload]
|
||||
|
||||
renderer/rendering_method="forward_plus"
|
||||
PlayerData="*uid://btw1rdth3dily"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1920
|
||||
window/size/viewport_height=1080
|
||||
window/size/mode=3
|
||||
|
|
|
|||
Loading…
Reference in a new issue