extends Area2D @onready var bullet = $Bullet/Sprite2D @export var speed = -250 var shader_active = false var pause = false func start(pos): position = pos func _process(delta): if pause == true: return position.y += speed * delta # Signal checks to see if the bullet leaves the viewport then removes bullet. func _on_visible_on_screen_notifier_2d_screen_exited() -> void: queue_free() func _on_area_entered(area: Area2D) -> void: var enemies = get_tree().get_nodes_in_group("enemies") for enemy in enemies: match enemy.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() "mirror": if area.is_in_group("enemies"): print("Mirror hit!") area.hit_detection() queue_free() "chicken": if area.is_in_group("enemies"): print("Chicken hit!") area.hit_detection() queue_free() #func bullet_fx(): #shader_active = true #bullet.material.set_shader_parameter("toggle", 1.0) #pause = true #await get_tree().create_timer(1).timeout #pause = false #shader_active = false #bullet.material.set_shader_parameter("toggle", 0.0)