cleanup, folder restructure and ui restructure

This commit is contained in:
Luca 2024-09-20 19:32:32 +02:00
parent 6ce579026b
commit b24117740b
28 changed files with 473 additions and 367 deletions

View file

@ -12,8 +12,8 @@ func _ready() -> void:
func setup_new_inventory() -> void:
var stats = MonsterStats.new()
stats.manual_init()
stats.manual_init("Bat", 2)
monsters.append(stats)
# debug timeout to wait for the debug UI
await get_tree().create_timer(1.0).timeout
await get_tree().create_timer(2.0).timeout
inventory_changed.emit()

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

Before

Width:  |  Height:  |  Size: 994 B

View file

@ -1,37 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b6pcv758bw37x"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="monsterfangen"
run/main_scene="res://scenes/main.tscn"
run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.3", "Mobile")
boot_splash/image="res://assets/logo/logo.png"
config/icon="res://assets/logo/logo.png"

View file

@ -9,6 +9,7 @@ var spitzname: String = ""
@export var base_attack: int = 10
@export var base_defense: int = 10
@export var base_speed: int = 10
@export var base_experience_for_next_level: int = 50
@export var model: PackedScene
var health: int
@ -16,13 +17,20 @@ var max_health: int
var attack: int
var defense: int
var speed: int
var experience: int
var experience_for_next_level: int
func _init() -> void:
max_health = base_health + 1.05 * level
max_health = roundi(base_health + 1.05 * level)
health = max_health
attack = base_attack
defense = base_defense
speed = base_speed
experience = 0
experience_for_next_level = roundi(base_experience_for_next_level + 1.10 * level)
print(health, max_health)
func manual_init() -> void:
func manual_init(p_name: String, p_level: int) -> void:
print("TODO: Manual init")
name = p_name
level = p_level

12
scenes/game.gd Normal file
View file

@ -0,0 +1,12 @@
extends Node3D
@onready var ui: UI = $UI
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
# Update the UI when the Inventory (global) changes
Inventory.inventory_changed.connect(ui._update_ui)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

14
scenes/game.tscn Normal file
View file

@ -0,0 +1,14 @@
[gd_scene load_steps=4 format=3 uid="uid://cswuap81n7t3f"]
[ext_resource type="PackedScene" uid="uid://p8agd0dfam0p" path="res://scenes/worlds/debug_level.tscn" id="1_j851n"]
[ext_resource type="Script" path="res://scenes/game.gd" id="1_mfbtr"]
[ext_resource type="PackedScene" uid="uid://b5y7pdfe6ougf" path="res://scenes/ui/ui.tscn" id="2_ynhuf"]
[node name="Game" type="Node3D"]
script = ExtResource("1_mfbtr")
[node name="CurrentLevel" type="Node3D" parent="."]
[node name="DebugLevel" parent="CurrentLevel" instance=ExtResource("1_j851n")]
[node name="UI" parent="." instance=ExtResource("2_ynhuf")]

View file

@ -1,289 +0,0 @@
[gd_scene load_steps=14 format=3 uid="uid://cswuap81n7t3f"]
[ext_resource type="Texture2D" uid="uid://b6ylra30qxf30" path="res://assets/logo/logo.png" id="1_fpt28"]
[ext_resource type="PackedScene" uid="uid://p8agd0dfam0p" path="res://scenes/debug_level.tscn" id="1_j851n"]
[ext_resource type="Script" path="res://scripts/inventory.gd" id="2_0mkyf"]
[ext_resource type="Script" path="res://scripts/joystick.gd" id="4_6b5cb"]
[ext_resource type="FontFile" uid="uid://bjaavdnopfh0q" path="res://assets/fonts/aoboshi_one/AoboshiOne-Regular.ttf" id="4_33gx1"]
[ext_resource type="Texture2D" uid="uid://8anyvhkcy4ng" path="res://assets/textures/Xbox Series/Vector/xbox_button_a.svg" id="5_pwhwh"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="6_78vsk"]
[ext_resource type="Script" path="res://scripts/monster_list.gd" id="6_shxjx"]
[ext_resource type="Script" path="res://scripts/camera_controls.gd" id="6_u5aqx"]
[ext_resource type="Texture2D" uid="uid://c737p2osplq2o" path="res://assets/textures/Xbox Series/Vector/xbox_button_x_outline.svg" id="7_rroeh"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kl7kg"]
bg_color = Color(0.8, 0.8, 0.8, 1)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_0o2ai"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wyqgq"]
bg_color = Color(0, 0, 0, 0.196078)
corner_radius_top_left = 999
corner_radius_top_right = 999
corner_radius_bottom_right = 999
corner_radius_bottom_left = 999
[node name="Main" type="Node3D"]
[node name="CurrentLevel" type="Node3D" parent="."]
[node name="DebugLevel" parent="CurrentLevel" instance=ExtResource("1_j851n")]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Inventory" type="Control" parent="CanvasLayer"]
layout_mode = 3
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
script = ExtResource("2_0mkyf")
[node name="MonsterList" type="VBoxContainer" parent="CanvasLayer/Inventory"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -137.0
offset_bottom = 40.0
grow_horizontal = 0
theme_override_constants/separation = 10
[node name="Monster1" type="Label" parent="CanvasLayer/Inventory/MonsterList"]
layout_mode = 2
text = "Monster 1: empty"
[node name="Monster2" type="Label" parent="CanvasLayer/Inventory/MonsterList"]
layout_mode = 2
text = "Monster 2: empty"
[node name="Monster3" type="Label" parent="CanvasLayer/Inventory/MonsterList"]
layout_mode = 2
text = "Monster 3: empty"
[node name="Monster4" type="Label" parent="CanvasLayer/Inventory/MonsterList"]
layout_mode = 2
text = "Monster 4: empty"
[node name="Monster5" type="Label" parent="CanvasLayer/Inventory/MonsterList"]
layout_mode = 2
text = "Monster 5: empty"
[node name="Monster6" type="Label" parent="CanvasLayer/Inventory/MonsterList"]
layout_mode = 2
text = "Monster 6: empty"
[node name="MainMenu" type="Control" parent="CanvasLayer"]
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/MainMenu"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 50
[node name="Logo" type="TextureRect" parent="CanvasLayer/MainMenu/VBoxContainer"]
layout_mode = 2
texture = ExtResource("1_fpt28")
expand_mode = 4
stretch_mode = 5
[node name="Label" type="Label" parent="CanvasLayer/MainMenu/VBoxContainer/Logo"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -23.0
grow_horizontal = 2
grow_vertical = 0
theme_override_colors/font_color = Color(0.945573, 0.745802, 0.348774, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 30
theme_override_fonts/font = ExtResource("4_33gx1")
theme_override_font_sizes/font_size = 70
text = "MONSTER
FANGEN"
horizontal_alignment = 1
max_lines_visible = 2
[node name="MenuButtons" type="VBoxContainer" parent="CanvasLayer/MainMenu/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
[node name="NewGameButton" type="Button" parent="CanvasLayer/MainMenu/VBoxContainer/MenuButtons"]
layout_mode = 2
text = "New Game"
[node name="ContinueGameButton" type="Button" parent="CanvasLayer/MainMenu/VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Continue"
[node name="OptionsButton" type="Button" parent="CanvasLayer/MainMenu/VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Options"
[node name="ExitButton" type="Button" parent="CanvasLayer/MainMenu/VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Exit"
[node name="ControlsLayer" type="CanvasLayer" parent="."]
[node name="CameraControls" type="Control" parent="ControlsLayer"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("6_u5aqx")
[node name="MonsterList" type="MarginContainer" parent="ControlsLayer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("6_shxjx")
[node name="MarginContainer" type="MarginContainer" parent="ControlsLayer/MonsterList"]
layout_mode = 2
theme_override_constants/margin_left = 40
theme_override_constants/margin_top = 40
theme_override_constants/margin_right = 40
theme_override_constants/margin_bottom = 40
[node name="PanelContainer" type="PanelContainer" parent="ControlsLayer/MonsterList/MarginContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_kl7kg")
[node name="VBoxContainer" type="VBoxContainer" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer"]
layout_mode = 2
[node name="Control" type="HBoxContainer" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/Control"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("4_33gx1")
theme_override_font_sizes/font_size = 50
text = "Your Monsters"
horizontal_alignment = 1
vertical_alignment = 1
[node name="CloseButton" type="Button" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/Control"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
icon = ExtResource("7_rroeh")
flat = true
[node name="MarginContainer" type="MarginContainer" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
[node name="MonsterListEntry" type="HBoxContainer" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
custom_minimum_size = Vector2(70, 70)
layout_mode = 2
texture = ExtResource("1_fpt28")
expand_mode = 2
[node name="MonsterID" type="Label" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
layout_mode = 2
size_flags_vertical = 1
text = "ID"
vertical_alignment = 1
[node name="MonsterName" type="Label" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
layout_mode = 2
size_flags_vertical = 1
text = "Name"
vertical_alignment = 1
[node name="MonsterLevel" type="Label" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
layout_mode = 2
size_flags_vertical = 1
text = "Lvl"
vertical_alignment = 1
[node name="MonsterHealth" type="Label" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
layout_mode = 2
size_flags_vertical = 1
text = "Health"
vertical_alignment = 1
[node name="ProgressBar" type="ProgressBar" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
[node name="Button" type="Button" parent="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/MarginContainer/MonsterListEntry"]
custom_minimum_size = Vector2(30, 30)
layout_mode = 2
size_flags_horizontal = 10
icon = ExtResource("6_78vsk")
flat = true
icon_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="ControlsLayer"]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -376.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 30
theme_override_constants/margin_bottom = 30
[node name="VBoxContainer2" type="VBoxContainer" parent="ControlsLayer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="MenuButton" type="Button" parent="ControlsLayer/MarginContainer/VBoxContainer2"]
custom_minimum_size = Vector2(150, 150)
layout_mode = 2
size_flags_horizontal = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_0o2ai")
icon = ExtResource("6_78vsk")
flat = true
icon_alignment = 1
expand_icon = true
[node name="Panel" type="Panel" parent="ControlsLayer/MarginContainer/VBoxContainer2"]
custom_minimum_size = Vector2(300, 300)
layout_mode = 2
size_flags_horizontal = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_wyqgq")
script = ExtResource("4_6b5cb")
[node name="Thumbstick" type="TextureRect" parent="ControlsLayer/MarginContainer/VBoxContainer2/Panel"]
self_modulate = Color(0, 0, 0, 0.392157)
custom_minimum_size = Vector2(100, 100)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = ExtResource("5_pwhwh")
[connection signal="gui_input" from="ControlsLayer/CameraControls" to="ControlsLayer/CameraControls" method="_on_gui_input"]
[connection signal="pressed" from="ControlsLayer/MonsterList/MarginContainer/PanelContainer/VBoxContainer/Control/CloseButton" to="ControlsLayer/MonsterList" method="_on_close_button_pressed"]
[connection signal="gui_input" from="ControlsLayer/MarginContainer/VBoxContainer2/Panel" to="ControlsLayer/MarginContainer/VBoxContainer2/Panel" method="_on_gui_input"]
[connection signal="resized" from="ControlsLayer/MarginContainer/VBoxContainer2/Panel" to="ControlsLayer/MarginContainer/VBoxContainer2/Panel" method="_on_resized"]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://cytaswycabcel"]
[ext_resource type="Script" path="res://scripts/monster.gd" id="1_13xtk"]
[ext_resource type="Material" uid="uid://ctul3e67rcq23" path="res://materials/CollisionDebugMaterial.tres" id="3_k6auu"]
[ext_resource type="Script" path="res://scenes/monster/monster.gd" id="1_5gfkg"]
[ext_resource type="Material" uid="uid://ctul3e67rcq23" path="res://materials/CollisionDebugMaterial.tres" id="2_bf2kb"]
[sub_resource type="SphereShape3D" id="SphereShape3D_tjvna"]
radius = 0.4
@ -11,7 +11,7 @@ radius = 0.4
height = 0.8
[node name="Monster" type="CharacterBody3D"]
script = ExtResource("1_13xtk")
script = ExtResource("1_5gfkg")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_tjvna")
@ -19,4 +19,4 @@ shape = SubResource("SphereShape3D_tjvna")
[node name="CollisionVisualizer" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_aou7a")
skeleton = NodePath("")
surface_material_override/0 = ExtResource("3_k6auu")
surface_material_override/0 = ExtResource("2_bf2kb")

View file

@ -1,7 +1,7 @@
class_name MonsterSpawnpoint
extends Node3D
@onready var monster_tscn = preload("res://scenes/monster.tscn")
@onready var monster_tscn = preload("res://scenes/monster/monster.tscn")
# a spawnpoint that can spawn monsters
# monsters are only spawned, if the player is not looking

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://dawpmu4vvv3rs"]
[ext_resource type="Script" path="res://scripts/monster_spawnpoint.gd" id="1_eyon3"]
[ext_resource type="Script" path="res://scenes/monster_spawnpoint/monster_spawnpoint.gd" id="1_p2vfw"]
[sub_resource type="SphereMesh" id="SphereMesh_phb77"]
radius = 0.4
@ -13,7 +13,7 @@ metallic = 1.0
roughness = 0.25
[node name="MonsterSpawnpoint" type="Node3D"]
script = ExtResource("1_eyon3")
script = ExtResource("1_p2vfw")
[node name="Diamond" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://be5bc5gjbo875"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_3fea3"]
[ext_resource type="PackedScene" uid="uid://cy36aygvs66pn" path="res://assets/models/gobot/gobot_skin.tscn" id="2_vivad"]
[ext_resource type="Script" path="res://scenes/player/player.gd" id="1_mv2yl"]
[ext_resource type="PackedScene" uid="uid://cy36aygvs66pn" path="res://assets/models/gobot/gobot_skin.tscn" id="2_a4t6w"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_xuba7"]
height = 1.7
@ -10,9 +10,9 @@ height = 1.7
axis_lock_angular_x = true
axis_lock_angular_y = true
axis_lock_angular_z = true
script = ExtResource("1_3fea3")
script = ExtResource("1_mv2yl")
[node name="GobotSkin" parent="." instance=ExtResource("2_vivad")]
[node name="GobotSkin" parent="." instance=ExtResource("2_a4t6w")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]

View file

@ -0,0 +1,7 @@
extends MarginContainer
class_name IngameControls
signal menu_button_clicked
func _on_menu_button_pressed() -> void:
menu_button_clicked.emit()

View file

@ -0,0 +1,73 @@
[gd_scene load_steps=7 format=3 uid="uid://1anjhvi173g3"]
[ext_resource type="Script" path="res://scenes/ui/ingame_controls.gd" id="1_iw1sp"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="1_wr5sh"]
[ext_resource type="Script" path="res://scripts/joystick.gd" id="2_pyri2"]
[ext_resource type="Texture2D" uid="uid://8anyvhkcy4ng" path="res://assets/textures/Xbox Series/Vector/xbox_button_a.svg" id="3_lgi8v"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_uoef2"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nfkty"]
bg_color = Color(0, 0, 0, 0.196078)
corner_radius_top_left = 999
corner_radius_top_right = 999
corner_radius_bottom_right = 999
corner_radius_bottom_left = 999
[node name="IngameControls" type="MarginContainer"]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -484.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 30
theme_override_constants/margin_bottom = 30
script = ExtResource("1_iw1sp")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 32
[node name="MenuButton" type="Button" parent="VBoxContainer"]
self_modulate = Color(0, 0, 0, 0.392157)
custom_minimum_size = Vector2(200, 200)
layout_mode = 2
size_flags_horizontal = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_uoef2")
icon = ExtResource("1_wr5sh")
flat = true
icon_alignment = 1
expand_icon = true
[node name="JoystickPanel" type="Panel" parent="VBoxContainer"]
custom_minimum_size = Vector2(400, 400)
layout_mode = 2
size_flags_horizontal = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_nfkty")
script = ExtResource("2_pyri2")
[node name="Thumbstick" type="TextureRect" parent="VBoxContainer/JoystickPanel"]
self_modulate = Color(0, 0, 0, 0.392157)
custom_minimum_size = Vector2(200, 200)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -32.0
offset_right = 32.0
offset_bottom = 32.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_lgi8v")
stretch_mode = 5
[connection signal="pressed" from="VBoxContainer/MenuButton" to="." method="_on_menu_button_pressed"]
[connection signal="gui_input" from="VBoxContainer/JoystickPanel" to="VBoxContainer/JoystickPanel" method="_on_gui_input"]
[connection signal="resized" from="VBoxContainer/JoystickPanel" to="VBoxContainer/JoystickPanel" method="_on_resized"]

67
scenes/ui/main_menu.tscn Normal file
View file

@ -0,0 +1,67 @@
[gd_scene load_steps=3 format=3 uid="uid://dt00rjsodtady"]
[ext_resource type="Texture2D" uid="uid://b6ylra30qxf30" path="res://assets/logo/logo.png" id="1_1fmce"]
[ext_resource type="FontFile" uid="uid://bjaavdnopfh0q" path="res://assets/fonts/aoboshi_one/AoboshiOne-Regular.ttf" id="2_aqmkw"]
[node name="MainMenu" type="Control"]
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 50
[node name="Logo" type="TextureRect" parent="VBoxContainer"]
layout_mode = 2
texture = ExtResource("1_1fmce")
expand_mode = 4
stretch_mode = 5
[node name="Label" type="Label" parent="VBoxContainer/Logo"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -23.0
grow_horizontal = 2
grow_vertical = 0
theme_override_colors/font_color = Color(0.945573, 0.745802, 0.348774, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 30
theme_override_fonts/font = ExtResource("2_aqmkw")
theme_override_font_sizes/font_size = 70
text = "MONSTER
FANGEN"
horizontal_alignment = 1
max_lines_visible = 2
[node name="MenuButtons" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
[node name="NewGameButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "New Game"
[node name="ContinueGameButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Continue"
[node name="OptionsButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Options"
[node name="ExitButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Exit"

View file

@ -0,0 +1,71 @@
[gd_scene load_steps=5 format=3 uid="uid://bbvbnrcjatkrb"]
[ext_resource type="Script" path="res://scripts/monster_list.gd" id="1_jk76e"]
[ext_resource type="FontFile" uid="uid://bjaavdnopfh0q" path="res://assets/fonts/aoboshi_one/AoboshiOne-Regular.ttf" id="2_hunv3"]
[ext_resource type="Texture2D" uid="uid://c737p2osplq2o" path="res://assets/textures/Xbox Series/Vector/xbox_button_x_outline.svg" id="3_08jy5"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_co4a0"]
bg_color = Color(0.9, 0.9, 0.9, 1)
corner_radius_top_left = 64
corner_radius_top_right = 64
corner_radius_bottom_right = 64
corner_radius_bottom_left = 64
[node name="MonsterList" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_jk76e")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 100
theme_override_constants/margin_top = 150
theme_override_constants/margin_right = 100
theme_override_constants/margin_bottom = 100
[node name="PanelContainer" type="PanelContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_co4a0")
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/PanelContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 32
[node name="Label" type="Label" parent="MarginContainer/PanelContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("2_hunv3")
theme_override_font_sizes/font_size = 50
text = "Your Monsters"
horizontal_alignment = 1
vertical_alignment = 1
[node name="MonsterListEntryContainer" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_bottom = 32
[node name="CloseButton" type="Button" parent="MarginContainer/PanelContainer/VBoxContainer/MarginContainer2"]
unique_name_in_owner = true
self_modulate = Color(0, 0, 0, 1)
custom_minimum_size = Vector2(150, 150)
layout_mode = 2
size_flags_horizontal = 4
icon = ExtResource("3_08jy5")
flat = true
icon_alignment = 1
expand_icon = true
[connection signal="pressed" from="MarginContainer/PanelContainer/VBoxContainer/MarginContainer2/CloseButton" to="." method="_on_close_button_pressed"]

View file

@ -0,0 +1,28 @@
extends HBoxContainer
class_name MonsterListEntry
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func populate(monster) -> void:
# thumbnail
# id
# name
# level
# health
# healthprogress
# experience
%MonsterID.text = str(0)
%MonsterName.text = monster.name
%MonsterLevel.text = "Lvl. %s" % monster.level
%HealthProgressBar.value = monster.health
%HealthProgressBar.max_value = monster.max_health
%ExperienceProgressBar.value = monster.experience
%ExperienceProgressBar.max_value = monster.experience_for_next_level

View file

@ -0,0 +1,107 @@
[gd_scene load_steps=9 format=3 uid="uid://brp2sljqnkuhe"]
[ext_resource type="Texture2D" uid="uid://b6ylra30qxf30" path="res://assets/logo/logo.png" id="1_16gb7"]
[ext_resource type="Script" path="res://scenes/ui/monster_list_entry.gd" id="1_spojl"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="2_5n4ar"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s3mod"]
content_margin_top = 24.0
bg_color = Color(0.4, 0.5, 0.455, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nb1sm"]
bg_color = Color(0, 0.843137, 0.466667, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fkb5g"]
content_margin_top = 12.0
bg_color = Color(0.4, 0.466667, 0.5, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b4pov"]
bg_color = Color(0, 0.56, 0.84, 1)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x2rfb"]
[node name="MonsterListEntry" type="HBoxContainer"]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 72.0
grow_horizontal = 2
script = ExtResource("1_spojl")
[node name="Thumbnail" type="TextureRect" parent="."]
unique_name_in_owner = true
custom_minimum_size = Vector2(70, 70)
layout_mode = 2
texture = ExtResource("1_16gb7")
expand_mode = 3
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
[node name="NameAndLevelContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="MonsterID" type="Label" parent="VBoxContainer/NameAndLevelContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "ID"
vertical_alignment = 1
[node name="MonsterName" type="Label" parent="VBoxContainer/NameAndLevelContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 40
text = "Name"
vertical_alignment = 1
[node name="MonsterLevel" type="Label" parent="VBoxContainer/NameAndLevelContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 8
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 40
text = "Lvl"
vertical_alignment = 1
[node name="ProgressBarContainer" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_constants/separation = 0
[node name="HealthProgressBar" type="ProgressBar" parent="VBoxContainer/ProgressBarContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_styles/background = SubResource("StyleBoxFlat_s3mod")
theme_override_styles/fill = SubResource("StyleBoxFlat_nb1sm")
step = 1.0
rounded = true
show_percentage = false
[node name="ExperienceProgressBar" type="ProgressBar" parent="VBoxContainer/ProgressBarContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_fkb5g")
theme_override_styles/fill = SubResource("StyleBoxFlat_b4pov")
step = 1.0
rounded = true
show_percentage = false
[node name="SwapPositionButton" type="Button" parent="."]
unique_name_in_owner = true
self_modulate = Color(0, 0, 0, 1)
custom_minimum_size = Vector2(150, 150)
layout_mode = 2
size_flags_horizontal = 8
theme_override_styles/focus = SubResource("StyleBoxEmpty_x2rfb")
icon = ExtResource("2_5n4ar")
flat = true
icon_alignment = 1
expand_icon = true

22
scenes/ui/ui.gd Normal file
View file

@ -0,0 +1,22 @@
extends CanvasLayer
class_name UI
@onready var monster_list: MarginContainer = %MonsterList
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_ingame_controls_menu_button_clicked() -> void:
monster_list.visible = true
# Updates the whole UI
func _update_ui() -> void:
# Updating the monster list
monster_list._update_monster_list()
print("UI updated")

30
scenes/ui/ui.tscn Normal file
View file

@ -0,0 +1,30 @@
[gd_scene load_steps=6 format=3 uid="uid://b5y7pdfe6ougf"]
[ext_resource type="Script" path="res://scenes/ui/ui.gd" id="1_vyi3s"]
[ext_resource type="Script" path="res://scripts/camera_controls.gd" id="1_x56x6"]
[ext_resource type="PackedScene" uid="uid://dt00rjsodtady" path="res://scenes/ui/main_menu.tscn" id="3_tcmm8"]
[ext_resource type="PackedScene" uid="uid://1anjhvi173g3" path="res://scenes/ui/ingame_controls.tscn" id="4_likk0"]
[ext_resource type="PackedScene" uid="uid://bbvbnrcjatkrb" path="res://scenes/ui/monster_list.tscn" id="5_qjqu1"]
[node name="UI" type="CanvasLayer"]
script = ExtResource("1_vyi3s")
[node name="CameraControlArea" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_x56x6")
[node name="MainMenu" parent="." instance=ExtResource("3_tcmm8")]
[node name="IngameControls" parent="." instance=ExtResource("4_likk0")]
[node name="MonsterList" parent="." instance=ExtResource("5_qjqu1")]
unique_name_in_owner = true
visible = false
[connection signal="gui_input" from="CameraControlArea" to="CameraControlArea" method="_on_gui_input"]
[connection signal="menu_button_clicked" from="IngameControls" to="." method="_on_ingame_controls_menu_button_clicked"]

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=11 format=3 uid="uid://p8agd0dfam0p"]
[ext_resource type="PackedScene" uid="uid://be5bc5gjbo875" path="res://scenes/player.tscn" id="1_ra6oo"]
[ext_resource type="PackedScene" uid="uid://dawpmu4vvv3rs" path="res://scenes/monster_spawnpoint.tscn" id="3_esgto"]
[ext_resource type="PackedScene" uid="uid://be5bc5gjbo875" path="res://scenes/player/player.tscn" id="1_ra6oo"]
[ext_resource type="PackedScene" uid="uid://dawpmu4vvv3rs" path="res://scenes/monster_spawnpoint/monster_spawnpoint.tscn" id="3_esgto"]
[ext_resource type="Script" path="res://resources/monster_stats.gd" id="3_iktqp"]
[ext_resource type="Resource" uid="uid://ym438vedcdyl" path="res://resources/DebugMonster1.tres" id="4_3y7gi"]
[ext_resource type="Resource" uid="uid://ym438vedcdyl" path="res://resources/monsters/DebugMonster1.tres" id="4_3y7gi"]
[sub_resource type="PlaneMesh" id="PlaneMesh_wak6a"]
size = Vector2(1000, 1000)

View file

@ -1,13 +0,0 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
Inventory.connect("inventory_changed", update_inventory)
pass # Replace with function body.
func update_inventory() -> void:
var m = Inventory.monsters[0]
var string = "%s Lvl %s, %s/%s" % [m.name, m.level, m.health, m.max_health]
$MonsterList/Monster1.text = string
print("Updating inventory")

View file

@ -1,16 +1,23 @@
extends MarginContainer
class_name MonsterList
@onready var monster_list_entry_container: MarginContainer = $MarginContainer/PanelContainer/VBoxContainer/MonsterListEntryContainer
@onready var monster_list_entry = preload("res://scenes/ui/monster_list_entry.tscn")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
visible = false
func _on_close_button_pressed() -> void:
visible = false
pass # Replace with function body.
func _update_monster_list() -> void:
for i in Inventory.monsters.size():
var monster = Inventory.monsters[i]
var entry = monster_list_entry.instantiate()
# populate the new entry
entry.populate(Inventory.monsters[i])
# add it to the list
monster_list_entry_container.add_child(entry)