extends Node2D enum { TOP, MID, BOT } var active_channel = TOP onready var fish = get_node("/root/Tank/Fish") func _ready(): pass func _on_Timer_timeout() -> void: active_channel += 1 if active_channel == TOP: var areas = $TopChannel.get_overlapping_areas() for area in areas: if area.is_in_group("Fish"): var destination = $TopChannel/CollisionShape2D.position - $TopChannel/CollisionShape2D.extents $TweenPush.interpolate_property(fish, "position:x", position.x, destination.x, 1.5, Tween.TRANS_CIRC, Tween.EASE_IN_OUT) print("Pushing fish back!") fish.get_node("TweenSwim").stop_all() if active_channel == MID: var areas = $MidChannel.get_overlapping_areas() for area in areas: if area.is_in_group("Fish"): print("Pushing fish back!") fish.get_node("TweenSwim").stop_all() if active_channel == BOT: var areas = $TopChannel.get_overlapping_areas() for area in areas: if area.is_in_group("Fish"): print("Pushing fish back!") fish.get_node("TweenSwim").stop_all()