I added a moving platform. Tutorial is finished. So now the player is on their own.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user