A fleet of neon-outlined ships explores a procedurally generated, seeded infinite world: tap/joystick steering, pinch zoom, formation pivoting, planet landings, an ore economy with extractors and haulers, and player built structures (mothership, ship crafter, command centre). All art is hand-drawn with draw_* calls rather than textures, and the backgrounds are camera-relative shaders so they stay precise at large world coordinates. Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot tooling that renders real frames through Xvfb and Mesa softpipe, since --headless has no GPU. Excluded from version control: .godot/ (import cache, and it holds export credentials), builds/, android/build/ and packaged APKs - all regenerable, and ~325 MB combined. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
47 lines
1.4 KiB
GDScript
47 lines
1.4 KiB
GDScript
extends Area2D
|
|
|
|
@export var speed: float = 500.0
|
|
@export var lifetime: float = 1.5
|
|
@export var damage: int = 1
|
|
@export var bolt_length: float = 20.0
|
|
|
|
var velocity: Vector2 = Vector2.ZERO
|
|
var age: float = 0.0
|
|
|
|
|
|
func _ready() -> void:
|
|
add_to_group("player_projectiles")
|
|
area_entered.connect(_on_area_entered)
|
|
|
|
|
|
func launch(direction: Vector2) -> void:
|
|
velocity = direction.normalized() * speed
|
|
rotation = direction.angle() + PI / 2.0
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
position += velocity * delta
|
|
age += delta
|
|
# Redrawn every frame. In principle a fixed shape only needs drawing
|
|
# once (see Asteroid.gd, where dropping this was a large win), but
|
|
# doing that here left bolts invisible on screen - verified by
|
|
# rendering a frame mid-combat and finding zero pixels of the bolt
|
|
# colour. Rather than ship invisible shots a second time, this keeps
|
|
# the redraw: projectiles are few and live under two seconds, so the
|
|
# cost is negligible.
|
|
queue_redraw()
|
|
if age >= lifetime:
|
|
queue_free()
|
|
|
|
|
|
func _on_area_entered(area: Area2D) -> void:
|
|
if area.is_in_group("enemies"):
|
|
area.take_damage(damage)
|
|
queue_free()
|
|
|
|
|
|
func _draw() -> void:
|
|
# Fixed-length, constant-brightness bolt. Drawn once and left alone.
|
|
var tip: Vector2 = Vector2(0, -bolt_length * 0.6)
|
|
var tail: Vector2 = Vector2(0, bolt_length * 0.4)
|
|
NeonDraw.draw_glowing_line(self, tail, tip, Color(1.0, 0.85, 0.3), 1.0, 0.5)
|