Flopsy/objects/lift/lift.gd

17 lines
435 B
GDScript3
Raw Permalink Normal View History

2022-07-17 14:24:15 +02:00
extends ReferenceRect
export var speed = 2
# Called when the node enters the scene tree for the first time.
func _ready():
$Lifter.position.y = self.rect_size.y
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
if $Lifter.position.y < 100 or $Lifter.position.y > self.rect_size.y:
speed = -speed
$Lifter.position.y -= speed
$Lifter.constant_linear_velocity.y = -speed