mirror of
https://github.com/Theaninova/mhlib.git
synced 2025-12-12 12:36:17 +00:00
Split project
This commit is contained in:
39
godot/mhjnr/profile/player_profile.gd
Normal file
39
godot/mhjnr/profile/player_profile.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
extends Resource
|
||||
|
||||
class_name PlayerProfile
|
||||
|
||||
const Statistics = preload("res://mhjnr/profile/statistics.gd")
|
||||
const Status = preload("res://mhjnr/profile/status.gd")
|
||||
|
||||
@export var name: String
|
||||
|
||||
@export var volume_music: int
|
||||
@export var volume_sfx: int
|
||||
|
||||
@export var current_level: int
|
||||
@export var game_finished: bool
|
||||
|
||||
@export var input_keys: Array[int] = []
|
||||
@export var input_buttons: Array[int] = []
|
||||
|
||||
@export var status: Status = Status.new()
|
||||
@export var statistics: Statistics = Statistics.new()
|
||||
|
||||
func from_object_data(data: ObjectData):
|
||||
name = data["name"]
|
||||
volume_music = data["volumeMusic"]
|
||||
volume_sfx = data["volumeSfx"]
|
||||
|
||||
for i in range(7):
|
||||
input_keys.push_back(data["input %d key"] % i)
|
||||
input_buttons.push_back(data["input %d button"] % i)
|
||||
|
||||
current_level = data["currentLevel"]
|
||||
game_finished = data["gameFinished"] != 0
|
||||
|
||||
for child in data.children:
|
||||
match child.resource_type:
|
||||
"Status":
|
||||
status.from_object_data(child)
|
||||
"Statistics":
|
||||
statistics.from_object_data(child)
|
||||
18
godot/mhjnr/profile/statistics.gd
Normal file
18
godot/mhjnr/profile/statistics.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends Resource
|
||||
|
||||
class_name Statistics
|
||||
|
||||
@export var num_shots_fired: int
|
||||
@export var num_coins_collected: int
|
||||
@export var num_diamonds_collected: int
|
||||
@export var enemies_bonus: int
|
||||
@export var num_powerups_collected: int
|
||||
@export var num_gold_statues: int
|
||||
|
||||
func from_object_data(data: ObjectData):
|
||||
num_shots_fired = data["numShotsFired"]
|
||||
num_coins_collected = data["numCoinsCollected"]
|
||||
num_diamonds_collected = data["numDiamondsCollected"]
|
||||
enemies_bonus = data["enemiesBonus"]
|
||||
num_powerups_collected = data["numPowerupsCollected"]
|
||||
num_gold_statues = data["numGoldStatues"]
|
||||
12
godot/mhjnr/profile/status.gd
Normal file
12
godot/mhjnr/profile/status.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends Resource
|
||||
|
||||
class_name Status
|
||||
|
||||
@export var lives: int
|
||||
@export var score: int
|
||||
@export var bullets: int
|
||||
|
||||
func from_object_data(data: ObjectData):
|
||||
lives = data["lives"]
|
||||
score = data["score"]
|
||||
bullets = data["bullets"]
|
||||
Reference in New Issue
Block a user