<As title says, enemy somehow doesn’t move on one-way platform. the collision layer of the ground is set to 1, and one-way platform is set to 10. Enemy’s collision mask is set to 1 and 10. What am I doing wrong? >
enum States {IDLE, AIR}
@onready var state: States = States.IDLE
func _ready():
pass
func _physics_process(delta):
$Label.set_text(States.keys()[state])
match state:
States.IDLE:
if !is_on_floor():
state = States.AIR
velocity.x = speed * direction
velocity.y += gravity * delta
move_and_slide()
$AnimationPlayer.play("idle")
if state == States.IDLE:
if is_on_wall() or not $RayCast2D.is_colliding():
direction *= -1
self.scale.x *= -1
States.AIR:
if is_on_floor:
state = States.IDLE
$AnimationPlayer.play("idle")
velocity.y += gravity * delta