JuggleBoard game v0.1: Godot 4.7 arcade, combo decay, config menu, circus BGM
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
extends Node
|
||||
## Singleton Settings: valori di calibrazione del gameplay, caricati/salvati
|
||||
## in user://settings.cfg. Modificati dal menù di configurazione e applicati
|
||||
## al riavvio della scena.
|
||||
|
||||
const PATH := "user://settings.cfg"
|
||||
|
||||
var start_time := 4.5 # tempo iniziale (s) tra un ordine e l'altro
|
||||
var min_time := 0.8 # tempo minimo (velocità massima)
|
||||
var time_ramp := 180.0 # secondi di gioco per difficoltà piena
|
||||
var score_ramp := 2000.0 # punteggio per difficoltà piena
|
||||
var points_per_combo := 10 # punti base per ogni livello di combo
|
||||
var combo_decay_threshold := 5.0 # combo sopra cui inizia il decay
|
||||
var combo_decay_rate := 0.06 # combo persi per unità sopra la soglia
|
||||
var difficulty_decay_rate := 0.3 # decay aggiuntivo legato alla difficoltà
|
||||
# Curva del punteggio: 0=quadratica, 1=scaglioni, 2=radice, 3=additiva
|
||||
var score_curve := 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
load_settings()
|
||||
|
||||
|
||||
func load_settings() -> void:
|
||||
var cfg := ConfigFile.new()
|
||||
if cfg.load(PATH) != OK:
|
||||
return # usa i default
|
||||
start_time = cfg.get_value("gameplay", "start_time", start_time)
|
||||
min_time = cfg.get_value("gameplay", "min_time", min_time)
|
||||
time_ramp = cfg.get_value("gameplay", "time_ramp", time_ramp)
|
||||
score_ramp = cfg.get_value("gameplay", "score_ramp", score_ramp)
|
||||
points_per_combo = cfg.get_value("gameplay", "points_per_combo", points_per_combo)
|
||||
combo_decay_threshold = cfg.get_value("gameplay", "combo_decay_threshold", combo_decay_threshold)
|
||||
combo_decay_rate = cfg.get_value("gameplay", "combo_decay_rate", combo_decay_rate)
|
||||
difficulty_decay_rate = cfg.get_value("gameplay", "difficulty_decay_rate", difficulty_decay_rate)
|
||||
score_curve = cfg.get_value("gameplay", "score_curve", score_curve)
|
||||
|
||||
|
||||
func save_settings() -> void:
|
||||
var cfg := ConfigFile.new()
|
||||
cfg.set_value("gameplay", "start_time", start_time)
|
||||
cfg.set_value("gameplay", "min_time", min_time)
|
||||
cfg.set_value("gameplay", "time_ramp", time_ramp)
|
||||
cfg.set_value("gameplay", "score_ramp", score_ramp)
|
||||
cfg.set_value("gameplay", "points_per_combo", points_per_combo)
|
||||
cfg.set_value("gameplay", "combo_decay_threshold", combo_decay_threshold)
|
||||
cfg.set_value("gameplay", "combo_decay_rate", combo_decay_rate)
|
||||
cfg.set_value("gameplay", "difficulty_decay_rate", difficulty_decay_rate)
|
||||
cfg.set_value("gameplay", "score_curve", score_curve)
|
||||
cfg.save(PATH)
|
||||
|
||||
|
||||
func reset_defaults() -> void:
|
||||
start_time = 4.5
|
||||
min_time = 0.8
|
||||
time_ramp = 180.0
|
||||
score_ramp = 2000.0
|
||||
points_per_combo = 10
|
||||
combo_decay_threshold = 5.0
|
||||
combo_decay_rate = 0.06
|
||||
difficulty_decay_rate = 0.3
|
||||
score_curve = 0
|
||||
Reference in New Issue
Block a user