fix enum name formatting, add initial quest basics

This commit is contained in:
tonydero 2024-10-17 14:11:10 -06:00
parent a5b8336633
commit a0f826525c
12 changed files with 217 additions and 64 deletions

20
assets/expbar.tres Normal file
View File

@ -0,0 +1,20 @@
[gd_resource type="Theme" load_steps=4 format=3 uid="uid://cp82s71sduhcv"]
[ext_resource type="FontFile" uid="uid://4q1f672e7ux2" path="res://addons/godot_vim/hack_regular.ttf" id="1_q1l18"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yg7tn"]
bg_color = Color(0.980392, 0.741176, 0.184314, 0.580392)
border_color = Color(0.491583, 0.491583, 0.491583, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_enag8"]
bg_color = Color(0.996078, 0.501961, 0.0980392, 1)
border_color = Color(0.491583, 0.491583, 0.491583, 1)
[resource]
ProgressBar/colors/font_color = Color(0.113725, 0.12549, 0.129412, 1)
ProgressBar/colors/font_outline_color = Color(0, 0, 0, 0.580392)
ProgressBar/constants/outline_size = 1
ProgressBar/font_sizes/font_size = 8
ProgressBar/fonts/font = ExtResource("1_q1l18")
ProgressBar/styles/background = SubResource("StyleBoxFlat_yg7tn")
ProgressBar/styles/fill = SubResource("StyleBoxFlat_enag8")

14
assets/healthbar.tres Normal file
View File

@ -0,0 +1,14 @@
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://clhh3c3gxotjg"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yg7tn"]
bg_color = Color(0.623529, 0, 0, 1)
border_color = Color(0.491583, 0.491583, 0.491583, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_enag8"]
bg_color = Color(0.207843, 0, 0, 1)
border_color = Color(0.491583, 0.491583, 0.491583, 1)
[resource]
default_font_size = 10
ProgressBar/styles/background = SubResource("StyleBoxFlat_yg7tn")
ProgressBar/styles/fill = SubResource("StyleBoxFlat_enag8")

View File

@ -1,19 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://55qfhbliodhn"]
[gd_scene load_steps=4 format=3 uid="uid://55qfhbliodhn"]
[ext_resource type="Script" path="res://scripts/NPCEnemy.gd" id="1_ec4cy"]
[ext_resource type="Texture2D" uid="uid://b10c1776j6j60" path="res://assets/icon.svg" id="2_twdr5"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yg7tn"]
bg_color = Color(0.623529, 0, 0, 1)
border_color = Color(0.491583, 0.491583, 0.491583, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_enag8"]
bg_color = Color(0.207843, 0, 0, 1)
border_color = Color(0.491583, 0.491583, 0.491583, 1)
[sub_resource type="Theme" id="Theme_fx206"]
ProgressBar/styles/background = SubResource("StyleBoxFlat_yg7tn")
ProgressBar/styles/fill = SubResource("StyleBoxFlat_enag8")
[ext_resource type="Theme" uid="uid://clhh3c3gxotjg" path="res://assets/healthbar.tres" id="3_tceil"]
[node name="NPCEnemy" type="CharacterBody2D"]
script = ExtResource("1_ec4cy")
@ -44,11 +33,10 @@ layout_mode = 2
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 16)
layout_mode = 2
theme = SubResource("Theme_fx206")
theme = ExtResource("3_tceil")
max_value = 10.0
step = 1.0
value = 10.0
show_percentage = false
[node name="TitleBox" type="HBoxContainer" parent="Sprite2D/MarginContainer/Nameplate"]
layout_mode = 2
@ -57,12 +45,11 @@ layout_mode = 2
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
text = "Tier
"
text = "I"
[node name="NPCNameLabel" type="Label" parent="Sprite2D/MarginContainer/Nameplate/TitleBox"]
[node name="NameLabel" type="Label" parent="Sprite2D/MarginContainer/Nameplate/TitleBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
text = "Name"
text = "Enemy"

24
scenes/quest.tscn Normal file
View File

@ -0,0 +1,24 @@
[gd_scene load_steps=2 format=3 uid="uid://klcyjys703l5"]
[ext_resource type="Script" path="res://scripts/Quest.gd" id="1_o0k38"]
[node name="Quest" type="HBoxContainer"]
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("1_o0k38")
[node name="ObjectiveLabel" type="Label" parent="."]
layout_mode = 2
text = "Quest Objective: "
[node name="CompletedLabel" type="Label" parent="."]
layout_mode = 2
text = "0"
[node name="Separator" type="Label" parent="."]
layout_mode = 2
text = "/"
[node name="GoalLabel" type="Label" parent="."]
layout_mode = 2
text = "1"

View File

@ -1,7 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://0h3dpe6fuhe8"]
[gd_scene load_steps=8 format=3 uid="uid://0h3dpe6fuhe8"]
[ext_resource type="Script" path="res://scripts/test_scroll_scene.gd" id="1_gc1kb"]
[ext_resource type="Theme" uid="uid://clhh3c3gxotjg" path="res://assets/healthbar.tres" id="2_2v2l0"]
[ext_resource type="PackedScene" uid="uid://klcyjys703l5" path="res://scenes/quest.tscn" id="2_dodxo"]
[ext_resource type="PackedScene" uid="uid://dvwo26vsk46tl" path="res://scenes/ability_ph.tscn" id="2_heria"]
[ext_resource type="Theme" uid="uid://cp82s71sduhcv" path="res://assets/expbar.tres" id="3_n8q4b"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_imvmd"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6jnvr"]
[node name="TestInstanceScene" type="Control"]
layout_mode = 3
@ -35,17 +42,56 @@ theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="UITop" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_vertical = 0
[node name="QuestsContainer" type="HBoxContainer" parent="MarginContainer/UITop"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
[node name="PHQuest" parent="MarginContainer/UITop/QuestsContainer" instance=ExtResource("2_dodxo")]
layout_mode = 2
[node name="UIBottom" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_vertical = 8
[node name="PlayerInfo" type="VBoxContainer" parent="MarginContainer/UIBottom"]
[node name="PlayerContainer" type="PanelContainer" parent="MarginContainer/UIBottom"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxEmpty_imvmd")
[node name="PlayerInfo" type="VBoxContainer" parent="MarginContainer/UIBottom/PlayerContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="PlayerHealthbar" type="ProgressBar" parent="MarginContainer/UIBottom/PlayerInfo"]
[node name="PlayerLabel" type="HBoxContainer" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo"]
layout_mode = 2
[node name="PlayerLevel" type="Label" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo/PlayerLabel"]
layout_mode = 2
text = "1"
[node name="PlayerName" type="Label" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo/PlayerLabel"]
layout_mode = 2
text = "Player"
[node name="PlayerHealthBar" type="ProgressBar" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo"]
custom_minimum_size = Vector2(0, 32)
layout_mode = 2
size_flags_vertical = 2
theme = ExtResource("2_2v2l0")
step = 1.0
value = 100.0
[node name="PlayerExpBar" type="ProgressBar" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo"]
layout_mode = 2
size_flags_vertical = 10
theme = ExtResource("3_n8q4b")
step = 1.0
value = 43.0
[node name="UIBottomCenter" type="VBoxContainer" parent="MarginContainer/UIBottom"]
custom_minimum_size = Vector2(384, 0)
@ -65,9 +111,11 @@ custom_minimum_size = Vector2(64, 64)
layout_mode = 2
[node name="AbilityA2" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
visible = false
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 6
attack_type = 3
attack_damage = 500
attack_speed = 3.5
@ -145,13 +193,19 @@ text = "Exit"
[node name="TouchScreenButton" type="TouchScreenButton" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu/ButtonExit"]
[node name="Player2FollowerInfo" type="VBoxContainer" parent="MarginContainer/UIBottom"]
[node name="MPlayerFollowerContainer" type="PanelContainer" parent="MarginContainer/UIBottom"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxEmpty_6jnvr")
[node name="MPlayerFollowerInfo" type="VBoxContainer" parent="MarginContainer/UIBottom/MPlayerFollowerContainer"]
visible = false
layout_mode = 2
size_flags_horizontal = 3
[node name="P2FHealthbar" type="ProgressBar" parent="MarginContainer/UIBottom/Player2FollowerInfo"]
visible = false
[node name="MPlayerFollowerHealthBar" type="ProgressBar" parent="MarginContainer/UIBottom/MPlayerFollowerContainer/MPlayerFollowerInfo"]
layout_mode = 2
theme = ExtResource("2_2v2l0")
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
[connection signal="pressed" from="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu/ButtonTest" to="." method="_on_button_test_pressed"]

View File

@ -1,13 +1,47 @@
# base ability class containing the main definitions
class_name AbilityBase
extends TextureRect
enum TARGTYPES { SINGLE, CLEAVE, CHAIN, SWIPE, WAVE, AREA, RAY }
enum PDMGTYPES { SLICE, PUNCTURE, BASH, HACK, SHRED }
enum MDMGTYPES { BURN, FREEZE, SHOCK, POISON, LIFE, RADIANT, ARCANE, FORCE }
enum SMODTYPES { STUN, SLOW, ABSORB, SHIELD, DOTB, DOTE }
enum TargTypes {
SINGLE,
CLEAVE,
CHAIN,
SWIPE,
WAVE,
AREA,
RAY,
}
enum PDmgTypes {
SLICE,
PUNCTURE,
BASH,
HACK,
SHRED,
}
enum MDmgTypes {
BURN,
FREEZE,
SHOCK,
POISON,
LIFE,
MENTAL,
RADIANT,
ARCANE,
FORCE
}
enum SModTypes {
STUN,
SLOW,
ABSORB,
SHIELD,
DOTB,
DOTE
}
@export var attack_range := 0
@export var attack_type := TARGTYPES.SINGLE
@export var attack_type := TargTypes.SINGLE
@export var attack_damage := 200
@export var attack_speed := 1.0
@export var attack_speed := 1.0
@export var base_cooldown := 0.0

View File

@ -3,16 +3,16 @@ class_name NPC
extends CharacterBody2D
enum npcDifficulties { MINION, NORMAL, ELITE, BOSS, ELITEBOSS, BBEG }
enum npcTiers { I, II, III, IV, V, VI, VII, VIII, IX, X }
enum NPCDifficulties {MINION, NORMAL, ELITE, BOSS, ELITEBOSS, BBEG}
enum NPCTiers {I, II, III, IV, V, VI, VII, VIII, IX, X}
signal npc_died(npcTier: npcTiers)
signal npc_died(npcTier: NPCTiers)
@export var charName := "Character"
@export var maxHealth := 10
@export var damageTaken := 0
@export var npcDifficulty: npcDifficulties
@export var npcTier: npcTiers
@export var npcDifficulty: NPCDifficulties
@export var npcTier: NPCTiers
func _random_mod_health() -> void:
randomize()
@ -21,15 +21,15 @@ func _random_mod_health() -> void:
self.maxHealth *= noise_factor
# difficulty factor
match self.npcDifficulty:
npcDifficulties.MINION:
NPCDifficulties.MINION:
self.maxHealth /= 2
npcDifficulties.ELITE:
NPCDifficulties.ELITE:
self.maxHealth *= 2
npcDifficulties.BOSS:
NPCDifficulties.BOSS:
self.maxHealth *= 4
npcDifficulties.ELITEBOSS:
NPCDifficulties.ELITEBOSS:
self.maxHealth *= 8
npcDifficulties.BBEG:
NPCDifficulties.BBEG:
self.maxHealth *= 16
# npcTier factor
self.maxHealth *= exp(self.npcTier)
@ -38,8 +38,8 @@ func _random_mod_health() -> void:
func _init() -> void:
self.npcDifficulty = npcDifficulties.NORMAL
self.npcTier = npcTiers.I
self.npcDifficulty = NPCDifficulties.NORMAL
self.npcTier = NPCTiers.I
func _ready() -> void:

View File

@ -5,7 +5,7 @@ extends NPC
enum questTypes {NONE, FEW_KILL, MANY_KILL, ONE_KILL}
signal enemy_died(npcDifficulty: npcDifficulties, questType: questTypes)
signal enemy_died(npcDifficulty: NPCDifficulties, questType: questTypes)
@export var questType: questTypes = questTypes.NONE
@ -15,8 +15,8 @@ var prevCollisions := 0
func _init() -> void:
self.npcDifficulty = npcDifficulties.NORMAL
self.npcTier = npcTiers.I
self.npcDifficulty = NPCDifficulties.NORMAL
self.npcTier = NPCTiers.I
func _ready() -> void:

20
scripts/Quest.gd Normal file
View File

@ -0,0 +1,20 @@
class_name Quest
extends HBoxContainer
enum GoalTypes { KILLMANY, KILLFEW, KILLONE, GETMANY, GETFEW, GETONE }
enum KillTypes { NATURAL, VOID }
@export var goalType := GoalTypes.KILLMANY
@export var killType := KillTypes.NATURAL
func _ready() -> void:
pass
# goalType = GoalTypes.
# match goalType:
# GoalTypes.KILLMANY:
# killType = KillTypes.NATURAL
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
pass

View File

@ -1,25 +1,25 @@
extends Node
extends NPC
func format_label_difficulty(label: Node, difficulty: NPC.npcDifficulties) -> void:
func format_label_difficulty(label: Node, difficulty: NPC.NPCDifficulties) -> void:
label.label_settings.outline_size = 4
match difficulty:
NPC.npcDifficulties.MINION:
NPCDifficulties.MINION:
label.label_settings.outline_color = Color.BLACK
label.label_settings.font_color = Color.LIGHT_GRAY
NPC.npcDifficulties.NORMAL:
NPCDifficulties.NORMAL:
label.label_settings.outline_color = Color.DARK_GREEN
label.label_settings.font_color = Color.LIME_GREEN
NPC.npcDifficulties.ELITE:
NPCDifficulties.ELITE:
label.label_settings.outline_color = Color.DARK_BLUE
label.label_settings.font_color = Color.DARK_CYAN
NPC.npcDifficulties.BOSS:
NPCDifficulties.BOSS:
label.label_settings.outline_color = Color.PURPLE
label.label_settings.font_color = Color.MAGENTA
NPC.npcDifficulties.ELITEBOSS:
NPCDifficulties.ELITEBOSS:
label.label_settings.outline_color = Color.ORANGE_RED
label.label_settings.font_color = Color.ORANGE
NPC.npcDifficulties.BBEG:
NPCDifficulties.BBEG:
label.label_settings.font_color = Color.GOLD
label.label_settings.outline_size = 8
label.label_settings.outline_color = Color.DARK_RED

View File

@ -6,9 +6,9 @@ var enemies = Array()
func _on_button_instantiate_pressed() -> void:
var middleX := get_viewport_rect().size.x/2
var upperY := get_viewport_rect().size.y/4
var middleY := get_viewport_rect().size.y/2
var middleX := get_viewport_rect().size.x / 2
var upperY := get_viewport_rect().size.y / 4
var middleY := get_viewport_rect().size.y / 2
for enemy in enemies:
remove_child(enemy)
@ -17,15 +17,15 @@ func _on_button_instantiate_pressed() -> void:
for i in range(numEnemies):
enemies.append(load("res://scenes/npc.tscn").instantiate())
add_child(enemies[i])
var posX := int(round((i + 1)*get_viewport_rect().size.x/(numEnemies + 1)))
var posX := int(round((i + 1) * get_viewport_rect().size.x / (numEnemies + 1)))
enemies[i].position = Vector2(posX, middleY)
enemies[0].get_node("%NPCNameLabel").text = "Test"
var bossEnemy = load("res://scenes/npc.tscn").instantiate()
bossEnemy.npcDifficulty = NPC.npcDifficulties.BOSS
bossEnemy.npcDifficulty = NPC.NPCDifficulties.BOSS
add_child(bossEnemy)
bossEnemy.position = Vector2(middleX, upperY)
#print(bossEnemy.npcDifficulty)
bossEnemy.scale = Vector2.ONE*1.6
bossEnemy.scale = Vector2.ONE * 1.6
func _on_button_exit_pressed() -> void:

View File

@ -9,13 +9,13 @@ func _on_exit_button_pressed() -> void:
func _on_test_button_pressed() -> void:
var rand_difficulty = NPC.npcDifficulties.values().pick_random()
var rand_tier = NPC.npcTiers.values().pick_random()
var rand_difficulty = NPC.NPCDifficulties.values().pick_random()
var rand_tier = NPC.NPCTiers.values().pick_random()
var anNPC = NPC.new()
%TestNMEMaxHealthVal.text = str(anNPC.maxHealth)
#TestEMaxHealthVal.label_settings = LabelSettings.new()
%TestNMEName.text = str(NPC.npcDifficulties.find_key(anNPC.npcDifficulty))
%TestNMETierVal.text = str(NPC.npcTiers.find_key(anNPC.npcTier))
%TestNMEName.text = str(NPC.NPCDifficulties.find_key(anNPC.npcDifficulty))
%TestNMETierVal.text = str(NPC.NPCTiers.find_key(anNPC.npcTier))
# style the name label based on the difficulty
styling.format_label_difficulty(%TestNMEName, anNPC.npcDifficulty)
#anNPC.position = Vector2(64, 64)