made a basic enemy that can harm/kill the player.
This commit is contained in:
sam committed 2026-10-02 21:10:47 -06:00
1 parent 2315add8ec
commit bb9682cd16
6 files changed
+117 -4

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
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()