feat: add juggling gym and animate circus sign

This commit is contained in:
enne2
2026-09-08 11:11:08 +02:00
parent d0991a0edf
commit 0e93e646b0
31 changed files with 629 additions and 19 deletions
+11
View File
@@ -2,7 +2,18 @@ class_name MenuAudio
extends Node
## Feedback sonori brevi dei menu, separati dal gameplay.
const SIGN_DROP := preload("res://menus/assets/audio/upendi_sign_drop_hf.wav")
const SIGN_BOUNCE := preload("res://menus/assets/audio/upendi_sign_bounce_hf.wav")
func play_tone(freq: float) -> void:
var stream := AudioFactory.create_tone(freq, 0.10, 0.16)
AudioFactory.play_once(self, stream, -4.0)
func play_sign_drop() -> void:
AudioFactory.play_once(self, SIGN_DROP, -8.0)
func play_sign_bounce() -> void:
AudioFactory.play_once(self, SIGN_BOUNCE, -7.0)
+8
View File
@@ -3,6 +3,7 @@ extends CanvasLayer
## Coordina navigazione e transizioni tra P1, P2a e P3a.
signal mode_requested
signal gym_requested
signal exit_requested
const HOME_SCENE := preload("res://menus/scenes/p1_home.tscn")
@@ -15,12 +16,14 @@ var menu_audio: MenuAudio
var current_screen: Control
var _transitioning := false
var _capture_enabled := false
var _capture_settled := false
func _ready() -> void:
process_mode = Node.PROCESS_MODE_ALWAYS
layer = 20
_capture_enabled = OS.get_cmdline_user_args().has("--capture-menus")
_capture_settled = OS.get_cmdline_user_args().has("--capture-settled")
_build_shell()
visible = false
@@ -105,6 +108,8 @@ func _bind_screen(screen: Control) -> void:
if screen is P1HomeScreen:
screen.juggle_requested.connect(func(focal: Control): _navigate(JUGGLE_SCENE, "p2a", focal))
screen.gym_requested.connect(func(focal: Control): _navigate(GYM_SCENE, "p3a", focal))
screen.sign_drop_started.connect(menu_audio.play_sign_drop)
screen.sign_bounced.connect(menu_audio.play_sign_bounce)
screen.exit_requested.connect(func():
menu_audio.play_tone(220.0)
exit_requested.emit()
@@ -115,6 +120,7 @@ func _bind_screen(screen: Control) -> void:
screen.feedback_requested.connect(menu_audio.play_tone)
elif screen is P3AGymMenuScreen:
screen.back_requested.connect(func(): _navigate(HOME_SCENE, "p1"))
screen.game_requested.connect(func(): gym_requested.emit())
screen.feedback_requested.connect(menu_audio.play_tone)
@@ -122,5 +128,7 @@ func _capture_after_frame(label: String) -> void:
if not _capture_enabled:
return
await RenderingServer.frame_post_draw
if _capture_settled:
await get_tree().create_timer(1.5, true, false, true).timeout
var image := get_viewport().get_texture().get_image()
image.save_png("/tmp/autgame_menu_%s.png" % label)
+26 -2
View File
@@ -5,6 +5,8 @@ extends Control
signal juggle_requested(focal: Control)
signal gym_requested(focal: Control)
signal exit_requested
signal sign_drop_started
signal sign_bounced
const HOME_BG := preload("res://menus/assets/common/1_sfondo.png")
const CLOUDS := preload("res://menus/assets/common/1_nuvole.png")
@@ -12,7 +14,7 @@ const BLUE_TENT := preload("res://menus/assets/p1/1_tendone_1.png")
const RED_TENT := preload("res://menus/assets/p1/1_tendone_2.png")
const BACK_BUTTON := preload("res://menus/assets/common/pulsante_indietro.png")
const SETTINGS_BUTTON := preload("res://menus/assets/common/pulsante_rotellina.png")
const CIRCUS_SIGN := preload("res://menus/assets/p1/upendi_circus_sign_mockup.png")
const CIRCUS_SIGN := preload("res://menus/assets/p1/upendi_circus_sign_static.png")
func _ready() -> void:
@@ -67,4 +69,26 @@ func _add_bottom_bar() -> void:
func _add_sign() -> void:
MenuUI.add_image(self, CIRCUS_SIGN, Vector2(0.50, 0.17), Vector2(0.43, 0.34))
var sign := TextureRect.new()
sign.texture = CIRCUS_SIGN
sign.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
sign.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
sign.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(sign)
MenuUI.set_normalized_rect(sign, Vector2(0.50, 0.17), Vector2(0.43, 0.34))
var final_y := sign.position.y
sign.position.y = final_y - sign.size.y * 1.15
var tween := create_tween()
# Il menu viene messo in pausa dalla shell: l'ingresso deve continuare comunque.
tween.set_pause_mode(Tween.TWEEN_PAUSE_PROCESS)
# Discesa rapida, breve superamento del punto d'arrivo e rimbalzo elastico.
call_deferred("_emit_sign_drop_started")
tween.tween_property(sign, "position:y", final_y + sign.size.y * 0.04, 1.10).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
tween.tween_property(sign, "position:y", final_y, 0.50).set_trans(Tween.TRANS_BOUNCE).set_ease(Tween.EASE_OUT)
tween.tween_callback(func(): sign_bounced.emit())
func _emit_sign_drop_started() -> void:
if is_inside_tree():
sign_drop_started.emit()
+5 -13
View File
@@ -3,6 +3,7 @@ extends Control
## P3A segue la stessa composizione mockup + hotspot trasparenti di P2A.
signal back_requested
signal game_requested
signal feedback_requested(frequency: float)
const MOCKUP := preload("res://menus/assets/p3a/p3a_menu_mockup.jpg")
@@ -29,7 +30,7 @@ func _build() -> void:
_add_hotspot(Vector2(0.12, 0.14), Vector2(0.10, 0.14), func(): back_requested.emit())
_add_hotspot(Vector2(0.775, 0.64), Vector2(0.07, 0.10), func(): _change_players(-1))
_add_hotspot(Vector2(0.895, 0.64), Vector2(0.07, 0.10), func(): _change_players(1))
_add_hotspot(Vector2(0.79, 0.88), Vector2(0.30, 0.14), _show_coming_soon)
_add_hotspot(Vector2(0.79, 0.88), Vector2(0.30, 0.14), _start_game)
_build_dynamic_count()
@@ -59,15 +60,6 @@ func _change_players(delta: int) -> void:
feedback_requested.emit(440.0 + 45.0 * players_count)
func _show_coming_soon() -> void:
feedback_requested.emit(260.0)
var note := MenuUI.add_label(self, "Presto disponibile", Vector2(0.79, 0.72), Vector2(0.28, 0.09), 24)
note.add_theme_color_override("font_color", Color("#4c2917"))
note.add_theme_stylebox_override("normal", MenuUI.note_style())
note.modulate.a = 0.0
var tween := create_tween()
tween.set_pause_mode(Tween.TWEEN_PAUSE_PROCESS)
tween.tween_property(note, "modulate:a", 1.0, 0.16)
tween.tween_interval(1.6)
tween.tween_property(note, "modulate:a", 0.0, 0.28)
tween.tween_callback(note.queue_free)
func _start_game() -> void:
feedback_requested.emit(784.0)
game_requested.emit()