Files
client/spacewar/bullet.gd
T
anekdotin e1410c234a Initial commit before folder reorganization
Checkpoint of the existing flat file layout prior to restructuring
into autoload/, menu/, ships/, world/, and assets/ folders.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 20:26:48 -04:00

22 lines
559 B
GDScript

extends Area2D
var velocity: Vector2 = Vector2.ZERO
var source: Node = null
func _ready() -> void:
body_entered.connect(_on_body_entered)
func _process(delta: float) -> void:
global_position += velocity * delta
var screen = get_viewport_rect().size
if (global_position.x < 0 or global_position.x > screen.x or
global_position.y < 0 or global_position.y > screen.y):
queue_free()
func _on_body_entered(body: Node) -> void:
if body == source:
return
if body.has_method("take_damage"):
body.take_damage(GameConfig.bullet_damage)
queue_free()