Files
wgj26/scripts/enemy.gd
T
sam bb9682cd16 Enemy
made a basic enemy that can harm/kill the player.
2026-10-02 21:10:47 -06:00

27 lines
339 B
GDScript

extends CharacterBody2D
var SPEED = Vector2(5, 0)
const JUMP_VELOCITY = -400.0
func _ready() -> void:
$Timer.start()
func _physics_process(delta: float) -> void:
velocity += get_gravity() * delta
move_and_slide()
patrol()
func patrol():
position += SPEED
func _on_timer_timeout() -> void:
SPEED = -SPEED
$Timer.start()