Updated pattern for boss; trying to get it to spawn bullets.

This commit is contained in:
Henry 2026-03-04 01:07:40 +00:00
parent caf2bffb0c
commit e608652170
24 changed files with 606 additions and 28 deletions

View file

@ -5,13 +5,32 @@ extends Area2D
@export var speed = -250
var shader_active = false
var pause = false
var target = null
func start(pos):
position = pos
func _ready():
var target_node = get_parent().get_node("root/$EnemyShard")
#var target = target_node.is_in_group("shards")
func _process(delta):
if pause == true: return
position.y += speed * delta
if target:
var direction = (target.position - position).normalized()
position += direction * speed * delta
if position.distance_to(target.position) < 10:
stick_to_target(target)
func stick_to_target(target):
target.add_child(bullet)
print("Sticking to target!")
position = Vector2.ZERO
# Signal checks to see if the bullet leaves the viewport then removes bullet.
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
@ -20,19 +39,20 @@ func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
func _on_area_entered(area: Area2D) -> void:
if area.is_in_group("enemies"):
match area.enemy_type:
"crt":
if area.is_in_group("enemies"):
print("CRT hit!")
area.hit_detection()
queue_free()
"shards":
if area.is_in_group("shards"):
print("Shards hit!")
area.hit_detection()
#stick_to_target(target)
queue_free()
"mirror":
if area.is_in_group("enemies"):
@ -45,6 +65,16 @@ func _on_area_entered(area: Area2D) -> void:
print("Chicken hit!")
area.hit_detection()
queue_free()
_:
if area.is_in_group("enemies"):
area.hit_detection()
if area.is_in_group("boss"):
print("I've shot the boss")
queue_free()
#func bullet_fx():
#shader_active = true