extends Position3D


var maxX = 20
var minX = -20

var SPEED = 10

var state = -1

# Called when the node enters the scene tree for the first time.
func _ready():
	pass


func _process(delta):
	if self.translation.x < minX or self.translation.x > maxX:
		self.state *= -1
	
	if state == -1:  # moving negative
		self.transform.origin += Vector3(1, 0, 0) * SPEED * delta
	elif state == 1:
		self.transform.origin += Vector3(-1, 0, 0) * SPEED * delta
