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>
40 lines
1.2 KiB
GDScript
40 lines
1.2 KiB
GDScript
extends Area2D
|
|
|
|
var velocity: Vector2 = Vector2.ZERO
|
|
var rotation_speed: float = 0.0
|
|
|
|
var shape_points: PackedVector2Array = PackedVector2Array()
|
|
|
|
|
|
func _ready() -> void:
|
|
randomize()
|
|
add_to_group("asteroids")
|
|
area_entered.connect(_on_area_entered)
|
|
|
|
var point_count: int = 7
|
|
for i in range(point_count):
|
|
var angle: float = (float(i) / point_count) * TAU
|
|
var radius: float = randf_range(14.0, 22.0)
|
|
shape_points.append(Vector2(cos(angle), sin(angle)) * radius)
|
|
queue_redraw()
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
# Deliberately no queue_redraw() here. position and rotation are node
|
|
# TRANSFORM properties - Godot applies them when rendering, and the
|
|
# polygon built in _ready() is in local space, so it never changes.
|
|
# Redrawing each frame re-tessellated four antialiased polylines per
|
|
# asteroid for an identical result; with ~150 asteroids on screen that
|
|
# was the single largest source of stutter.
|
|
position += velocity * delta
|
|
rotation += rotation_speed * delta
|
|
|
|
|
|
func _on_area_entered(area: Area2D) -> void:
|
|
if area.is_in_group("player_ships"):
|
|
AsteroidExplosionVFX.spawn(get_tree().root, position)
|
|
queue_free()
|
|
|
|
|
|
func _draw() -> void:
|
|
NeonDraw.draw_glowing_polygon(self, shape_points, Color(0.65, 0.5, 0.35), 1.0)
|