Pause Menu
Handles game pausing/unpausing and features an animated 3D chicken character, dynamic button visibility, smooth transitions, and focus handling.
Key Components:
PauseMenu.gd
: Main controller scriptpause_menu.tscn
: Scene container
Properties
Property | Type | Description |
---|---|---|
chicken | Node3D | The 3D chicken character to animate during paused state |
camera | Camera3D | Game camera to adjust during pause animations |
footer | PanelContainer | Bottom menu panel that slides in (not used) |
game_logo_container | MarginContainer | Logo container with hover effects |
paused | bool | Controls pause state with setter logic |
prev_mouse_mode | Input.MouseMode | Stores previous mouse mode before pausing |
UI Elements
Node | Type | Description |
---|---|---|
Resume | Button | Unpauses the game |
Settings | Button | Opens the settings ui |
Quit | Button | Returns to main menu |
Forfeit | Button | Forfeits the fight and returns to poultryman menu |
Core Mechanics
Pause State Management
var paused: bool: set(value): paused = value visible = value get_tree().paused = value Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if value else prev_mouse_mode if value: get_parent().move_child(self, get_parent().get_child_count() - 1) _set_button_visibility()
Behaviour:
- Freezes the whole scene tree when paused, except itself. Since this node’s process mode is set to
PROCESS_MODE_ALWAYS
, it will never get paused in the scene tree. - Handles mouse visibility when paused and unpaused.
- Ensures this menu is always on top of other UI’s.
- Updates the button visiblity dynamically.
Input Handling
func _input(event: InputEvent) -> void: if Input.is_action_just_pressed("pause"): if not paused: prev_mouse_mode = Input.mouse_mode paused = not paused if paused: _squish_chicken() resume_button.grab_focus()
Key Features:
- Toggles pause on
pause
action in the input mappings. (default key is ESC) - Preserves the previous mouse mode before entering this node.
- Auto-focuses on the resume button.
- Triggers the 3d chicken animation when entering this node.
Visual Design
Color Palette
Usage | Hex | Sample |
---|---|---|
button normal font | #bebcbe | Sample |
button hover font | #878085 | Sample |
button focus font | #878085 | Sample |
button pressed font | #eae7dc | Sample |
button normal bg | transparent | Sample |
button hover bg | #cccbc7 | Sample |
button focus bg | #cccbc7 | Sample |
button pressed bg | #262520 | Sample |
Typography
Element | Font | Size |
---|---|---|
button | Frost Scream | 36px |
Flow
- Player presses pause button
- Game freezes (physics/process stops)
- Menu appears with animation
- Player selects option
- Menu closes with animation
- Game resumes
Dependencies
- Uses
SignalManager
to switch interfaces - Uses
TweenManager
for animations