Fix collider and add waves

This commit is contained in:
DerTyp7
2023-09-20 16:45:48 +02:00
parent 12cf356951
commit 1eaae06040
7 changed files with 99 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ var speed: float = 100.0
var motion: Vector2 = Vector2.ZERO
func _ready():
set_meta("dead", false)
pass
func _physics_process(delta):
@@ -11,12 +12,22 @@ func _physics_process(delta):
var direction = (player.position - position).normalized()
motion = direction * speed
look_at(player.position)
move_and_collide(motion * delta)
func _on_area_2d_body_entered(body):
#func _on_area_2d_body_entered(body):
# print("Bullet hit")
# print(body.name)
# if "Bullet" in body.name:
# set_meta("dead", true)
# queue_free()
func _on_area_2d_area_entered(area):
print("Bullet hit")
print(body.name)
if "Bullet" in body.name:
print(area.get_parent().name)
if "Bullet" in area.get_parent().name:
set_meta("dead", true)
area.get_parent().queue_free()
queue_free()