fix: preserve circus sign silhouette and ropes
This commit is contained in:
@@ -109,7 +109,7 @@ func _bind_screen(screen: Control) -> void:
|
||||
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.sign_landed.connect(menu_audio.play_sign_bounce)
|
||||
screen.exit_requested.connect(func():
|
||||
menu_audio.play_tone(220.0)
|
||||
exit_requested.emit()
|
||||
|
||||
@@ -6,6 +6,7 @@ signal juggle_requested(focal: Control)
|
||||
signal gym_requested(focal: Control)
|
||||
signal exit_requested
|
||||
signal sign_drop_started
|
||||
signal sign_landed
|
||||
signal sign_bounced
|
||||
|
||||
const HOME_BG := preload("res://menus/assets/common/1_sfondo.png")
|
||||
@@ -14,7 +15,8 @@ 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_static.png")
|
||||
const CIRCUS_SIGN_PANEL := preload("res://menus/assets/p1/upendi_circus_sign_panel.png")
|
||||
const CIRCUS_SIGN_ROPES := preload("res://menus/assets/p1/upendi_circus_sign_ropes.png")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -69,26 +71,42 @@ func _add_bottom_bar() -> void:
|
||||
|
||||
|
||||
func _add_sign() -> void:
|
||||
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))
|
||||
# Il pannello si muove, mentre le funi restano ancorate al bordo superiore.
|
||||
# Separare i due livelli conserva la texture disegnata originale senza lasciare
|
||||
# un vuoto quando il pannello supera verso il basso il punto di riposo.
|
||||
var rig := Control.new()
|
||||
rig.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
add_child(rig)
|
||||
MenuUI.set_normalized_rect(rig, Vector2(0.50, 0.17), Vector2(0.43, 0.34))
|
||||
|
||||
_add_sign_layer(rig, CIRCUS_SIGN_ROPES)
|
||||
var panel := _add_sign_layer(rig, CIRCUS_SIGN_PANEL)
|
||||
var final_y := panel.position.y
|
||||
panel.position.y = final_y - panel.size.y * 1.15
|
||||
|
||||
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.
|
||||
# Discesa rapida, atterraggio evidente 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_property(panel, "position:y", final_y + panel.size.y * 0.11, 1.10).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
|
||||
# L'impatto è sincronizzato con la massima estensione, prima del ritorno elastico.
|
||||
tween.tween_callback(func(): sign_landed.emit())
|
||||
tween.tween_property(panel, "position:y", final_y, 0.50).set_trans(Tween.TRANS_BOUNCE).set_ease(Tween.EASE_OUT)
|
||||
tween.tween_callback(func(): sign_bounced.emit())
|
||||
|
||||
|
||||
func _add_sign_layer(parent: Control, texture: Texture2D) -> TextureRect:
|
||||
var layer := TextureRect.new()
|
||||
layer.texture = texture
|
||||
layer.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
layer.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
layer.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
parent.add_child(layer)
|
||||
layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
return layer
|
||||
|
||||
|
||||
func _emit_sign_drop_started() -> void:
|
||||
if is_inside_tree():
|
||||
sign_drop_started.emit()
|
||||
|
||||
Reference in New Issue
Block a user