23 lines
493 B
GDScript
23 lines
493 B
GDScript
extends TileMapLayer
|
|
|
|
var moving_up :bool = true
|
|
var speed :float = 50.0
|
|
var distance_moved :float = 0.0
|
|
var moving = false
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
if moving:
|
|
var movement = speed * delta
|
|
|
|
if moving_up:
|
|
position.y -= movement
|
|
distance_moved += movement
|
|
if distance_moved >= 479.7:
|
|
moving_up = false
|
|
|
|
|
|
func _on_platform_body_entered(body: Node2D) -> void:
|
|
print(body)
|
|
moving = true
|