Character Roll prototype

This commit is contained in:
2024-06-11 10:23:43 -04:00
parent cdbba45795
commit 4312c044d3
210 changed files with 3633 additions and 180 deletions

13
Boss/bossData.json Normal file
View File

@@ -0,0 +1,13 @@
{
"bosses": [
{
"name": "Ice Giant",
"description": "The guardian of the Ice Caves",
"totalHealth": 1000,
"minDPS": 1,
"minClickDmg": 1,
"isAvailable": true,
"texturePath": "res://Images/Bosses/Frost_Guardian_FREE_v1.0/PNG files/idle/idle_1.png"
}
]
}

39
Boss/bossDatabase.gd Normal file
View File

@@ -0,0 +1,39 @@
# BossDatabase.gd
extends Node
var boss_data = {}
# Called when the node enters the scene tree for the first time.
func _ready():
load_boss_data()
# Function to load character data from the JSON file
func load_boss_data():
#var file = FileAccess.open("res://Boss/bossData.json", FileAccess.READ)
var file = FileAccess.open("user://Boss/bossData.json", FileAccess.READ)
if file:
var json_text = file.get_as_text()
#print (json_text)
file.close()
var json = JSON.new()
var json_result = json.parse(json_text)
#print (json_result)
if json_result == OK:
boss_data = json.get_data()
print("Boss data loaded successfully.")
#print(character_data)
else:
print("Failed to parse JSON: ", json_result.error_string)
else:
print("Boss data file not found.")
# Function to get a character by name
func get_boss(name: String) -> Dictionary:
for boss in boss_data.bosses:
if boss.name == name:
return boss
return {}