17 lines
435 B
GDScript3
17 lines
435 B
GDScript3
|
extends ReferenceRect
|
||
|
|
||
|
export var speed = 2
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
$Lifter.position.x = self.rect_size.x
|
||
|
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _physics_process(delta):
|
||
|
if $Lifter.position.x < 100 or $Lifter.position.x > self.rect_size.x:
|
||
|
speed = -speed
|
||
|
$Lifter.position.x -= speed
|
||
|
$Lifter.constant_linear_velocity.x = -speed
|
||
|
|