26 lines
512 B
GDScript
26 lines
512 B
GDScript
extends "res://objects/enemy/enemy.gd"
|
|
|
|
|
|
var speed: float = 80.0
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
position.x -= speed * delta
|
|
|
|
func _on_Hitbox_area_entered(area: Node) -> void:
|
|
._on_Hitbox_area_entered(area)
|
|
if area.is_in_group("player_hitbox"):
|
|
_stop()
|
|
|
|
|
|
func _on_Hitbox_body_entered(body: Node) -> void:
|
|
if body is TileMap:
|
|
_stop()
|
|
|
|
|
|
func _stop() -> void:
|
|
speed = 0.0
|
|
$Hitbox.queue_free()
|
|
for child in $Particles.get_children():
|
|
if child is CPUParticles2D:
|
|
child.emitting = false
|