aboutsummaryrefslogtreecommitdiff
path: root/client/menu/character.gd
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2025-06-03 22:25:32 +0200
committertpart <tpart120@proton.me>2025-06-03 22:25:37 +0200
commita2c2f9c84ba43c218556926b0f6650318e701d68 (patch)
tree3251dd8004a83c6e3e219cc616a819eea64372f8 /client/menu/character.gd
parent29772d6b2f244c6c172347c5e96530a16ca4517d (diff)
downloadhurrycurry-a2c2f9c84ba43c218556926b0f6650318e701d68.tar
hurrycurry-a2c2f9c84ba43c218556926b0f6650318e701d68.tar.bz2
hurrycurry-a2c2f9c84ba43c218556926b0f6650318e701d68.tar.zst
Support new character style system
Diffstat (limited to 'client/menu/character.gd')
-rw-r--r--client/menu/character.gd32
1 files changed, 27 insertions, 5 deletions
diff --git a/client/menu/character.gd b/client/menu/character.gd
index fb224dd7..f40aeffb 100644
--- a/client/menu/character.gd
+++ b/client/menu/character.gd
@@ -25,7 +25,7 @@ extends Menu
func _ready():
super()
$VBoxContainer/top_panel/a/username.text = Global.get_profile("username")
- character.set_style(Global.get_profile("character"))
+ character.set_style(Global.get_profile("character_style"), "chef")
init_map()
func init_map():
@@ -73,9 +73,31 @@ func _on_back_pressed():
replace_menu("res://menu/main.tscn")
func _on_character_back_pressed():
- Global.set_profile("character", max(Global.get_profile("character") - 1, 0))
- character.set_style(Global.get_profile("character"))
+ modify_style(func m(current_style: Dictionary):
+ current_style.color = G.rem_euclid(current_style.color - 1, character.NUM_COLORS))
func _on_character_forward_pressed():
- Global.set_profile("character", max(Global.get_profile("character") + 1, 0))
- character.set_style(Global.get_profile("character"))
+ modify_style(func m(current_style: Dictionary):
+ current_style.color = G.rem_euclid(current_style.color + 1, character.NUM_COLORS))
+
+func _on_headwear_back_pressed() -> void:
+ modify_style(func m(current_style: Dictionary):
+ current_style.headwear = G.rem_euclid(current_style.headwear - 1, character.NUM_HEADWEARS))
+
+func _on_headwear_forward_pressed() -> void:
+ modify_style(func m(current_style: Dictionary):
+ current_style.headwear = G.rem_euclid(current_style.headwear + 1, character.NUM_HEADWEARS))
+
+func _on_hairstyle_back_pressed() -> void:
+ modify_style(func m(current_style: Dictionary):
+ current_style.hairstyle = G.rem_euclid(current_style.hairstyle - 1, character.NUM_HAIRS))
+
+func _on_hairstyle_forward_pressed() -> void:
+ modify_style(func m(current_style: Dictionary):
+ current_style.hairstyle = G.rem_euclid(current_style.hairstyle + 1, character.NUM_HAIRS))
+
+func modify_style(modifier: Callable):
+ var current_style: Dictionary = Global.get_profile("character_style")
+ modifier.call(current_style)
+ Global.set_profile("character_style", current_style)
+ character.set_style(Global.get_profile("character_style"), "chef")