Hi all! I have an idea that I’m struggling to figure out.
I’m currently making a visual novel, and there needs to be a toggle that will change character sprites from one form to another, depending on the player’s preference. To make this easy-to-follow, let’s say the options are pajamas and formal clothes.
Upon opening the game, the player should be able to pick either pajamas or formal clothes. Depending on their choice, all character sprites throughout the entire game will have the character in those clothes. Since this preference will span multiple scenes, I’m not sure how to put it into action.
Adding to the autoload idea, two things that helped me with something similar (card skins in my game).
Save the choice, or the player picks again on every launch:
# in the autoload
var outfit := "pajamas"
func save_prefs() -> void:
var cfg := ConfigFile.new()
cfg.set_value("prefs", "outfit", outfit)
cfg.save("user://prefs.cfg")
func load_prefs() -> void:
var cfg := ConfigFile.new()
if cfg.load("user://prefs.cfg") == OK:
outfit = cfg.get_value("prefs", "outfit", outfit)
And keep the sprite lookup in one place, a function that takes a character name and returns the texture for the current outfit, instead of each scene building its own path. A third outfit then means one change. If the player can switch mid-scene, emit a signal from the autoload and have the sprites listen for it.