spaceship/AsteroidExplosionVFX.gd
Loïc Wisniewski 85814ce88c Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
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>
2026-08-10 18:41:58 +02:00

29 lines
923 B
GDScript

class_name AsteroidExplosionVFX
extends ExplosionVFXBase
# Tumbling rock-chunk debris, distinct from the energy-ship light-burst
# style - asteroids are matter, not light.
const COLOR: Color = Color(0.65, 0.5, 0.35)
static func spawn(parent: Node, world_position: Vector2) -> void:
var vfx: AsteroidExplosionVFX = AsteroidExplosionVFX.new()
vfx.position = world_position
parent.add_child(vfx)
func _random_particle_size() -> float:
return randf_range(3.0, 7.0)
func _draw_particle(p: Dictionary, alpha: float) -> void:
var s: float = p["size"]
var local_pts: PackedVector2Array = PackedVector2Array([
Vector2(-s, -s * 0.6), Vector2(s * 0.7, -s * 0.5),
Vector2(s, s * 0.5), Vector2(-s * 0.6, s),
])
var world_pts: PackedVector2Array = PackedVector2Array()
for pt in local_pts:
world_pts.append(p["pos"] + pt.rotated(p["rot"]))
draw_colored_polygon(world_pts, Color(COLOR.r, COLOR.g, COLOR.b, alpha))