GMTK-2024/gmtk_2024/scripts/enemy_movement_mover.gd

14 lines
255 B
GDScript3
Raw Normal View History

2024-08-17 12:55:16 +02:00
extends CharacterBody2D
@export var speed = 200;
@export var gravity = 50;
2024-08-17 17:33:34 +02:00
@export var direction = 1;
2024-08-17 12:55:16 +02:00
func _physics_process(delta):
if is_on_wall():
direction = direction * -1
velocity.x = direction * speed
velocity.y += gravity
move_and_slide()