GMTK-2024/gmtk_2024/scripts/enemy_movement_mover.gd
2024-08-18 23:30:19 +02:00

15 lines
301 B
GDScript

extends CharacterBody2D
@export var speed = 200;
@export var gravity = 50;
@export var direction = 1;
func _ready() -> void:
add_to_group("enemy")
func _physics_process(delta):
if is_on_wall():
direction = direction * -1
velocity.x = direction * speed
velocity.y += gravity
move_and_slide()