cleanup, folder restructure and ui restructure
This commit is contained in:
parent
6ce579026b
commit
b24117740b
28 changed files with 473 additions and 367 deletions
12
scenes/game.gd
Normal file
12
scenes/game.gd
Normal 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
14
scenes/game.tscn
Normal 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")]
|
||||
289
scenes/main.tscn
289
scenes/main.tscn
|
|
@ -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"]
|
||||
53
scenes/monster/monster.gd
Normal file
53
scenes/monster/monster.gd
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
class_name Monster
|
||||
extends CharacterBody3D
|
||||
|
||||
@export var stats: MonsterStats
|
||||
|
||||
var spawn_point: Vector3 = Vector3(0, 0, 0)
|
||||
|
||||
# DEBUG MOVEMENT
|
||||
@onready var time: float = 16.0
|
||||
@onready var frequency: float = 1.0
|
||||
@onready var amplitude: float = 0.5
|
||||
|
||||
var in_battle: bool = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var model_instance = stats.model.instantiate()
|
||||
frequency = randf_range(1.0, 4.0)
|
||||
amplitude = randf_range(1.0, 6.0)
|
||||
spawn_point = position
|
||||
add_child(model_instance)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if in_battle:
|
||||
velocity = Vector3.ZERO
|
||||
return
|
||||
|
||||
time += delta
|
||||
var x_movement = sin(time * frequency) * amplitude
|
||||
var z_movement = cos(time * frequency) * amplitude
|
||||
velocity = Vector3(x_movement, 0, z_movement)
|
||||
|
||||
# if move_and_slide reports collisions
|
||||
if move_and_slide():
|
||||
var collision = get_slide_collision(0)
|
||||
var collider = collision.get_collider()
|
||||
|
||||
# if the monster collided with the player...
|
||||
if collider.name == "Player":
|
||||
velocity = Vector3.ZERO
|
||||
in_battle = true
|
||||
|
||||
# calculate players new position
|
||||
# from the camera 3 units backwards
|
||||
var camera = collider.find_child("Camera3D")
|
||||
|
||||
# local z axis of the camera
|
||||
var local_z = camera.global_transform.basis.z
|
||||
|
||||
var new_player_position = camera.global_transform.origin + local_z * 3
|
||||
|
||||
collider.start_battle(self, new_player_position)
|
||||
#rotate_toward(rotation.z, collider.rotation.z, 1.0)
|
||||
|
|
@ -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")
|
||||
82
scenes/monster_spawnpoint/monster_spawnpoint.gd
Normal file
82
scenes/monster_spawnpoint/monster_spawnpoint.gd
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
class_name MonsterSpawnpoint
|
||||
extends Node3D
|
||||
|
||||
@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
|
||||
|
||||
# list that holds all spawnable monsters
|
||||
@export var spawnable_monsters: Array[MonsterStats]
|
||||
|
||||
# ignore spawning only if visible
|
||||
@export var ignore_visibility: bool = false
|
||||
|
||||
# the maximum amount of spawned monsters
|
||||
# no monsters will spawn, when this number is reached
|
||||
@export var max_monsters: int = 5
|
||||
|
||||
# the maximum lifetime a monster can be in the world
|
||||
# a monster is then deleted if the following conditions are met:
|
||||
# the monster has exceeded its maximum lifetime and it is not on screen
|
||||
# TODO: figure out how to check for the exceeded lifetime and delete
|
||||
@export var max_lifetime: float = 60.0 # seconds
|
||||
|
||||
# only spawn a monster every x seconds
|
||||
@export var spawn_cooldown: float = 3.0 # seconds
|
||||
|
||||
@onready var spawn_timer: Timer = Timer.new()
|
||||
@onready var time: float = 16.0
|
||||
@onready var frequency: float = 1.0
|
||||
@onready var amplitude: float = 0.5
|
||||
@onready var spawn_point: Vector3 = Vector3(0, 0, 0)
|
||||
|
||||
@onready var label: Label3D = $Label3D
|
||||
|
||||
# a spawnpoint should keep track of spawned entities
|
||||
var active_monsters: Array[Monster] = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
spawn_timer.wait_time = spawn_cooldown
|
||||
spawn_timer.autostart = true
|
||||
spawn_timer.timeout.connect(spawn)
|
||||
add_child(spawn_timer)
|
||||
spawn_timer.start()
|
||||
|
||||
spawn_point = position
|
||||
|
||||
func spawn() -> void:
|
||||
if len(active_monsters) >= max_monsters:
|
||||
print("Spawnpoint reached maximum amount of monsters")
|
||||
return
|
||||
|
||||
if ignore_visibility == false and $VisibleOnScreenNotifier3D.is_on_screen():
|
||||
print("Spawnpoint is visible on screen. Not spawning a monster.")
|
||||
return
|
||||
|
||||
# TODO: Add a check to not spawn enemies X units near the player
|
||||
|
||||
# instantiate a monster .tscn scene
|
||||
var monster_to_spawn = monster_tscn.instantiate()
|
||||
monster_to_spawn.stats = spawnable_monsters[0]
|
||||
|
||||
# keep track of the current monster
|
||||
active_monsters.append(monster_to_spawn)
|
||||
label.text = "%s / %s" % [len(active_monsters), max_monsters]
|
||||
|
||||
# calculate the position of the monster and add the offset of the spawnpoint itself
|
||||
var monster_position = Vector3(position.x, position.y + 1, position.z)
|
||||
monster_to_spawn.position = monster_position
|
||||
|
||||
var debug_level_node = get_parent_node_3d()
|
||||
debug_level_node.add_child(monster_to_spawn)
|
||||
print("Spawning Mob \"%s\"" % monster_to_spawn.stats.name)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
time += delta
|
||||
var diamond_rotation: float = sin(time * frequency) * amplitude
|
||||
var diamond_height: float = sin(time * frequency) * amplitude
|
||||
$Diamond.rotation.y = diamond_rotation
|
||||
$Diamond.position.y = 2.0 + diamond_height
|
||||
|
|
@ -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)
|
||||
76
scenes/player/player.gd
Normal file
76
scenes/player/player.gd
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
@onready var animated_mesh = $GobotSkin
|
||||
|
||||
var in_battle: bool = false
|
||||
|
||||
const SPEED = 5.0
|
||||
const JUMP_VELOCITY = 4.5
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if in_battle == true:
|
||||
return
|
||||
|
||||
animated_mesh.idle()
|
||||
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
animated_mesh.fall()
|
||||
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
print("jump")
|
||||
animated_mesh.run()
|
||||
|
||||
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||
velocity.y = JUMP_VELOCITY
|
||||
|
||||
# Camera rotation
|
||||
var camera_input_dir := Input.get_vector("joystick_right_left", "joystick_right_right", "joystick_right_left", "joystick_right_right")
|
||||
$CameraRoot.rotation.y += camera_input_dir.x * 0.2
|
||||
|
||||
# Get the input direction and handle the movement / deceleration.
|
||||
# As good practice, you should replace UI actions with custom gameplay actions.
|
||||
var input_dir := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
|
||||
if input_dir.length() > 0 and is_on_floor():
|
||||
animated_mesh.run()
|
||||
if input_dir.length() > 0 and not is_on_floor():
|
||||
animated_mesh.fall()
|
||||
|
||||
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
|
||||
# Rotate the direction with the camera, so that the cameras forward direction
|
||||
# is the joysticks and the players forward direction
|
||||
direction = direction.rotated(Vector3.UP, $CameraRoot.rotation.y)
|
||||
|
||||
# Move character to the direction
|
||||
if direction.length() != 0:
|
||||
$GobotSkin.rotation.y = atan2(direction.x,direction.z)
|
||||
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
if velocity.length() < 0.05:
|
||||
animated_mesh.idle()
|
||||
|
||||
# what happens when a battle starts?
|
||||
# the player is positioned (mostly somewhere else than the current position)
|
||||
# ui changes
|
||||
# music changes
|
||||
func start_battle(enemy: Node3D, player_position: Vector3) -> void:
|
||||
position = Vector3(player_position.x, position.y, player_position.z)
|
||||
in_battle = true
|
||||
velocity = Vector3.ZERO
|
||||
animated_mesh.idle()
|
||||
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
print("timer over")
|
||||
in_battle = false
|
||||
|
|
@ -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="."]
|
||||
7
scenes/ui/ingame_controls.gd
Normal file
7
scenes/ui/ingame_controls.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends MarginContainer
|
||||
class_name IngameControls
|
||||
|
||||
signal menu_button_clicked
|
||||
|
||||
func _on_menu_button_pressed() -> void:
|
||||
menu_button_clicked.emit()
|
||||
73
scenes/ui/ingame_controls.tscn
Normal file
73
scenes/ui/ingame_controls.tscn
Normal 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
67
scenes/ui/main_menu.tscn
Normal 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"
|
||||
71
scenes/ui/monster_list.tscn
Normal file
71
scenes/ui/monster_list.tscn
Normal 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"]
|
||||
28
scenes/ui/monster_list_entry.gd
Normal file
28
scenes/ui/monster_list_entry.gd
Normal 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
|
||||
107
scenes/ui/monster_list_entry.tscn
Normal file
107
scenes/ui/monster_list_entry.tscn
Normal 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
22
scenes/ui/ui.gd
Normal 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
30
scenes/ui/ui.tscn
Normal 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"]
|
||||
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue