diff --git a/visible_on_screen_notifier_2d.gd b/visible_on_screen_notifier_2d.gd new file mode 100644 index 0000000..cdb6896 --- /dev/null +++ b/visible_on_screen_notifier_2d.gd @@ -0,0 +1,15 @@ +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 diff --git a/visible_on_screen_notifier_2d.gd.uid b/visible_on_screen_notifier_2d.gd.uid new file mode 100644 index 0000000..26210a7 --- /dev/null +++ b/visible_on_screen_notifier_2d.gd.uid @@ -0,0 +1 @@ +uid://bapvlrx6dm7gu