Files
turnbasedstrategygame/visible_on_screen_notifier_2d.gd
2025-12-06 15:21:51 +01:00

16 lines
387 B
GDScript

extends VisibleOnScreenNotifier2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
_calculateRect()
get_tree().root.size_changed.connect(_calculateRect)
func _calculateRect():
var multiplier: float = get_viewport_rect().size.y / get_viewport_rect().size.x
var size: float = 640 / multiplier
rect.position.y = -size/2
rect.size.y = size