add spawning
This commit is contained in:
18
src/NPCs/malegoblin.gd
Normal file
18
src/NPCs/malegoblin.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends KinematicBody2D
|
||||
|
||||
const MOVEMENT_VECTORS = [
|
||||
Vector2.UP,
|
||||
Vector2.RIGHT,
|
||||
Vector2.DOWN,
|
||||
Vector2.LEFT
|
||||
]
|
||||
|
||||
func _physics_process(_delta):
|
||||
var movement = MOVEMENT_VECTORS[randi() % 4]
|
||||
move_and_collide(movement * 2)
|
||||
|
||||
func _on_Hurtbox_area_entered(_area):
|
||||
$Hurtbox/death.play()
|
||||
|
||||
func _on_death_finished():
|
||||
queue_free()
|
Reference in New Issue
Block a user