Flopsy/objects/hlift/hlift.gd

17 lines
435 B
GDScript3
Raw Permalink Normal View History

2022-07-18 08:51:54 +02:00
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