Enemy
made a basic enemy that can harm/kill the player.
This commit is contained in:
1 parent
2315add8ec
commit
bb9682cd16
6 files changed
+117
-4
No files matched your search
@@ -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()
|
||||
Reference in new issue
Block a user