1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-22 16:14:22 +00:00
looping-for-loops/Objects/ScrollingObjects/Utilities/WrapParent.gd

13 lines
319 B
GDScript3
Raw Normal View History

2020-10-04 15:29:28 +00:00
extends Node2D
class_name WrapParent
onready var parent: Node2D = get_parent()
onready var wrapper: Wrapper = get_tree().current_scene.get_node("Wrapper")
onready var absolute_position: Vector2 = parent.position
2020-10-04 18:26:45 +00:00
func _physics_process(_delta):
2020-10-04 15:29:28 +00:00
if global_position.x <= 0:
parent.position.x += wrapper.total_length