Files
wgj26/scenes/core/phonebooth.gd
T
bigmstone de90af743c Lot of cleanup
Reorganize project structure into scenes and scripts directories

    - Move core game objects (player, enemy, projectile, cassette, phonebooth) to scenes/core/
    - Move UI helpers (title, pause_screen, game_over, speech) to scenes/helpers/
    - Move puzzle logic (phonephreak) to scenes/puzzles/
    - Move global utilities to scripts/
    - Consolidate levels in scenes/levels/ with new base_level structure
    - Fix naming conventions (snake_case for scripts)
    - Remove obsolete test and duplicate scenes
2026-10-04 15:27:34 -06:00

54 lines
2.4 KiB
GDScript

extends Node2D
@onready var phonephreak = preload("res://scenes/puzzles/phonephreak.tscn")
func _ready() -> void:
pass # Replace with function body.
func _process(delta: float) -> void:
pass
func _on_area_2d_body_entered(body: Node2D) -> void:
if get_parent().get_tree().get_nodes_in_group("Cassets").is_empty():
if $CanvasLayer.get_children().is_empty():
var inst: Control = phonephreak.instantiate()
$CanvasLayer.add_child(inst)
print("== IMMEDIATE ==")
_dump(inst)
await get_tree().process_frame
await get_tree().process_frame
print("== AFTER 2 FRAMES ==")
_dump(inst)
GlobalData.doing_puzzle = true
$CanvasLayer.add_child(inst)
inst.set_anchors_and_offsets_preset(Control.PRESET_CENTER, Control.PRESET_MODE_KEEP_SIZE)
inst.grow_vertical = Control.GROW_DIRECTION_BOTH
inst.grow_horizontal = Control.GROW_DIRECTION_BOTH
else:
get_parent().get_node("Speech").say(
"I need to find all the music!",
get_parent().get_parent().get_node("player").SpeechMarker,
5.0
)
func _dump(inst: Control) -> void:
var vp := get_viewport()
print("window size: ", get_window().size, " content_scale_mode: ", get_window().content_scale_mode)
print("visible_rect: ", vp.get_visible_rect(), " -> screen center: ", vp.get_visible_rect().size / 2.0)
print("layer: offset=", $CanvasLayer.offset, " scale=", $CanvasLayer.scale, " rotation=", $CanvasLayer.rotation,
" follow_viewport=", $CanvasLayer.follow_viewport_enabled)
print("root: type=", inst.get_class(), " pos=", inst.position, " size=", inst.size,
" min=", inst.get_combined_minimum_size(), " scale=", inst.scale, " pivot=", inst.pivot_offset)
print("root anchors L/T/R/B: ", inst.anchor_left, " ", inst.anchor_top, " ", inst.anchor_right, " ", inst.anchor_bottom,
" offsets: ", inst.offset_left, " ", inst.offset_top, " ", inst.offset_right, " ", inst.offset_bottom)
print("root global_rect: ", inst.get_global_rect(), " -> its center: ", inst.get_global_rect().get_center())
print("root parent: ", inst.get_parent().name, " (", inst.get_parent().get_class(), ")")
for c in inst.get_children():
if c is Control:
print(" child ", c.name, " (", c.get_class(), ") global_rect=", c.get_global_rect(),
" visible=", c.visible, " anchors preset-ish: ", c.anchor_left, ",", c.anchor_top, ",", c.anchor_right, ",", c.anchor_bottom)
else:
print(" child ", c.name, " (", c.get_class(), ")")