Overview
Themain_menu.gd script controls Nyuron’s main menu scene. It handles:
- Minigame launching with proper screen orientation
- Character skin updates based on equipped items
- Progress panel and store navigation
- Coin display formatting
- Decorative seagull spawning
- UI fade-in animations
res://scenes/main_menu.tscn
Key Methods
update_menu_skin()
Updates the character’s visual appearance based on equipped items from ScoreManager.No return value
- Fetches equipped shell and accessory from ScoreManager
- Maps item names to file suffixes using lookup dictionaries
- Constructs texture path:
res://Accesorios/global/spr_rest{color}{accessory}.png - Applies texture to AnimatedSprite2D frames
- Default:
spr_rest.png - Blue shell:
spr_rest_blue.png - Blue shell + crown:
spr_rest_blue_corona.png
- During
_ready()(main_menu.gd:58) - After skin changes via ScoreManager signal
fade_in_ui()
Animates UI elements from transparent to opaque after scene loads.Duration of fade animation in seconds
No return value
- Targets all nodes in the
"ui"group - Tweens
modulate.afrom 0.0 to 1.0 - Re-enables mouse interaction after fade completes
load_and_update_coins()
Fetches coin count from ScoreManager and updates the UI label with formatted display.No return value
format_number() to abbreviate large values (K/M suffixes)
Example Usage:
format_number()
Formats large numbers with K/M suffixes for compact display.Number to format
Formatted string with K/M suffix if applicable
< 1,000: No suffix (e.g., “523”)≥ 1,000: K suffix (e.g., “1.5K”, “42.3K”)≥ 1,000,000: M suffix (e.g., “2.1M”)
has_seen_intro()
Checks if player has completed the intro sequence.true if intro was seen, false otherwise- Reads from
user://player_data.cfg - Checks
player.intro_seenvalue - Returns
falseif file doesn’t exist
Minigame Launchers
Each minigame has a dedicated launcher method that:- Sets appropriate screen orientation
- Configures viewport resolution
- Changes to the minigame scene
_on_turtle_pressed()
Launches Turtle Runner minigame. Configuration:- Orientation: Landscape
- Resolution: 480×270
- Scene:
res://minigames/turtle_run/scenes/main.tscn
_on_worm_pressed()
Launches Worm Catch minigame. Configuration:- Orientation: Portrait
- Resolution: 270×480
- Scene:
res://minigames/worm_bucket/Scenes/main.tscn
_on_food_pressed()
Launches Food Catch minigame. Configuration:- Orientation: Portrait
- Resolution: 270×480
- Scene:
res://minigames/food_catch/scenes/Main.tscn
_on_memorice_pressed()
Launches Memorice matching game. Configuration:- Orientation: Portrait
- Resolution: 270×480
- Scene:
res://minigames/memorice/scenes/minijuego_memorice.tscn
_on_counting_pressed()
Launches Counting Animals minigame. Configuration:- Orientation: Landscape
- Resolution: 480×270
- Scene:
res://minigames/counting_animals/scenes/Main.tscn
_on_color_pressed()
Launches Nyuron Color minigame. Configuration:- Orientation: Portrait
- Resolution: 270×480
- Scene:
res://minigames/nyuron_color/scenes/Main.tscn
Navigation Methods
_toggle_menu()
Toggles the slide-out minigame selection panel. Behavior:- Shows/hides
menu_panel - Dims background with overlay when open
- Hides other UI elements for focus
- Auto-closes progress panel if open
_on_tienda_pressed()
Navigates to the store/shop scene._on_progress_button_pressed()
Opens the progress/achievements panel. Actions:- Closes minigame menu if open
- Updates progress info and achievements
- Shows progress panel
- Hides main UI buttons
- Shows dim overlay
_on_progress_hud_closed()
Closes the progress panel and restores main UI.Cosmetic System Lookups
menu_color_codes Dictionary
Maps shell item names to texture file suffixes:menu_accessory_codes Dictionary
Maps accessory item names to texture file suffixes:Seagull Spawning
_spawn_gaviota()
Spawns decorative seagulls that fly across the screen. Configuration:- Triggered by
spawn_timertimeout signal - Random direction (left-to-right or right-to-left)
- Random Y position between
altura_minandaltura_max - Spawns offscreen, flies across viewport
Complete Usage Example
Node References
UI Elements
Button References
Architecture Notes
- Screen Orientation: Portrait by default (270×480), switches to landscape for certain minigames
- Intro Guard: Redirects to intro scene on first launch
- Transition Integration: Waits for TransitionBlocks to complete before fading in UI
- Cosmetic System: Dynamically loads character textures based on ScoreManager state
- Progress Panel: Two-way communication via signals (
back_pressed,play_game_pressed)