Frontier-of-Hell/scripts/bullets/bullet_1.gd

18 lines
379 B
GDScript3
Raw Normal View History

2023-10-06 11:40:11 +02:00
extends Area2D
const right = Vector2.RIGHT
2023-10-07 18:13:45 +02:00
var speed : int = 0
var damage : int = 0
2023-10-06 11:40:11 +02:00
func _physics_process(delta):
var movement = right.rotated(rotation) * speed * delta
global_position += movement
func _on_VisibilityNotifier2D_screen_exited():
queue_free()
func _on_Bullet_body_entered(body):
if body.is_in_group("Enemy"):
2023-10-06 14:25:13 +02:00
body.get_parent().hit(damage)
2023-10-06 11:40:11 +02:00
queue_free()