diff --git a/components/padding.gd b/components/padding.gd new file mode 100644 index 0000000..4f95907 --- /dev/null +++ b/components/padding.gd @@ -0,0 +1,3 @@ +class_name Padding +extends Control +## Control node used to add space between container items. diff --git a/components/stats_tools/booster.gd b/components/stats_tools/booster.gd new file mode 100644 index 0000000..cf1fea8 --- /dev/null +++ b/components/stats_tools/booster.gd @@ -0,0 +1,23 @@ +class_name Booster +extends Resource +## Base resource class for Booster Foods! + + +@export var food_name: String +@export_multiline var short_description: String +@export var icon: Texture2D +@export var affected_stat: String +@export var change_value: float # can be casted to int as necessary +@export var price: int + + +## initialize so there aren't any issues using these in the editor. +func _init(init_name = "", init_desc = "", init_icon = null, init_stat = "", + init_val = 0.0, init_price = 0): + + food_name = init_name + short_description = init_desc + icon = init_icon + affected_stat = init_stat + change_value = init_val + price = init_price diff --git a/components/stats_tools/booster.tres b/components/stats_tools/booster.tres new file mode 100644 index 0000000..73b6303 --- /dev/null +++ b/components/stats_tools/booster.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://br3ucckj8lmgp"] + +[ext_resource type="Script" path="res://components/stats_tools/booster.gd" id="1_lcruv"] + +[resource] +resource_name = "booster_res" +script = ExtResource("1_lcruv") diff --git a/components/stats_tools/booster_db.tres b/components/stats_tools/booster_db.tres new file mode 100644 index 0000000..269384a --- /dev/null +++ b/components/stats_tools/booster_db.tres @@ -0,0 +1,35 @@ +[gd_resource type="Resource" script_class="BoosterDB" load_steps=2 format=3 uid="uid://dgbomeqa4gsaj"] + +[sub_resource type="GDScript" id="GDScript_6i4qn"] +resource_name = "boosterDB" +script/source = "class_name BoosterDB +extends Resource +## Resource for storing Booster Food information to display in the Shop or GUI +## +## This resource holds onto all the data and methods used to manage items shown +## in the shop. Information is stored in a simple dictionary (easier to find stuff +## and comes with simple CRUD operations to start with) +## +## NOTE: This data isn't intended to be manipulated at run time. + + +## The dictionary of Booster Foods. +const DB := {} + + +## initialize exports so it can be used in editor + + +## func to add an item + + +## func to remove an item + + +## func to find and return an item + + +## func to update an item - need the property being changed and the new value" + +[resource] +script = SubResource("GDScript_6i4qn") diff --git a/components/stats_tools/stats.gd b/components/stats_tools/stats.gd new file mode 100644 index 0000000..7826454 --- /dev/null +++ b/components/stats_tools/stats.gd @@ -0,0 +1,40 @@ +class_name Stats +extends RefCounted +## Class for managing fluctating data values on character or env scenes. +## +## Stats plural because you can define multiple stats. Used for adjustable +## numerical values that reset every level. (Since that's all we have in this game.) +## Sticks to floating point numbers for all stats. For now. + + +## Container for all stats for whatever this is attached to. +var stats: Dictionary = {} + + +## Add a stat - if you need an int, use casting +func add(stat_name: String, stat_value: float): + if stats.has(stat_name): + print("STATS: stat exists - overwriting value...") + stats[stat_name] = stat_value + + +## Remove a stat +func remove(stat_name: String): + if stats.has(stat_name): + stats.erase(stat_name) + else: + print("STATS: stat doesn't exist. Moving on.") + + +## Update a stat +## The value should be calculated/recasted by whatever system is modifying the stat. +func update(stat_name: String, stat_value: float): + if stats.has(stat_name): + stats[stat_name] = stat_value + else: + print("STATS: stat doesn't exist") + + +## Get a stat's value +func view_stat(stat_name) -> float: + return stats.get(stat_name) diff --git a/resources/coin_display_anim_texture.tres b/resources/coin_display_anim_texture.tres new file mode 100644 index 0000000..9b68957 --- /dev/null +++ b/resources/coin_display_anim_texture.tres @@ -0,0 +1,31 @@ +[gd_resource type="AnimatedTexture" load_steps=6 format=3 uid="uid://dcykmm3yegfdt"] + +[ext_resource type="Texture2D" uid="uid://cu6h23nn0y6dp" path="res://assets/Coin (16 x 16).png" id="1_gpbq7"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_g0q1f"] +atlas = ExtResource("1_gpbq7") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0jr2f"] +atlas = ExtResource("1_gpbq7") +region = Rect2(19, 0, 10, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_udtw2"] +atlas = ExtResource("1_gpbq7") +region = Rect2(38, 0, 4, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qnswx"] +atlas = ExtResource("1_gpbq7") +region = Rect2(51, 0, 10, 16) + +[resource] +resource_name = "coin_display_anim_texture" +frames = 4 +frame_0/texture = SubResource("AtlasTexture_g0q1f") +frame_0/duration = 0.25 +frame_1/texture = SubResource("AtlasTexture_0jr2f") +frame_1/duration = 0.25 +frame_2/texture = SubResource("AtlasTexture_udtw2") +frame_2/duration = 0.25 +frame_3/texture = SubResource("AtlasTexture_qnswx") +frame_3/duration = 0.25