-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start of the booster foods resources (#8)
- Loading branch information
1 parent
c7dc2f5
commit 3f541e3
Showing
6 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class_name Padding | ||
extends Control | ||
## Control node used to add space between container items. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |