extends RigidBody2D var max_distance = position + Vector2(1,0) var move_speed = 0.01 func _ready() -> void: add_to_group("MovingPlatform") func _process(delta: float) -> void: print(max_distance) position.x = move_toward(position.x, max_distance.x, move_speed) func on_enter(body) -> void: print("ON MOVING PLATFORM") if %Player2D.is_on_floor(): %Player2D.is_on_moving_platform = true %Player2D.platform_speed = move_speed func on_leave(body) -> void: print("OFF MOVING PLATFORM") %Player2D.is_on_moving_platform = false