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>
This commit is contained in:
commit
85814ce88c
192 changed files with 9602 additions and 0 deletions
72
tests/test_asteroid_ship_collision.gd
Normal file
72
tests/test_asteroid_ship_collision.gd
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
extends SceneTree
|
||||
|
||||
# Headless gameplay test: run with
|
||||
# godot --headless -s res://tests/test_asteroid_ship_collision.gd
|
||||
# Verifies that a ship touching an asteroid destroys BOTH the ship (removed
|
||||
# from the fleet) and the asteroid itself (mutual destruction), each
|
||||
# spawning its own coherent explosion VFX: light-burst blue for the ship,
|
||||
# debris brown for the asteroid.
|
||||
|
||||
const CHECK_DELAY: float = 0.05
|
||||
|
||||
var main_scene: Node
|
||||
var fleet: Node
|
||||
var target_ship: Node
|
||||
var asteroid: Node2D
|
||||
var elapsed: float = 0.0
|
||||
var stage: int = 0
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
var packed: PackedScene = load("res://Main.tscn")
|
||||
main_scene = packed.instantiate()
|
||||
root.add_child(main_scene)
|
||||
fleet = main_scene.get_node("Fleet")
|
||||
|
||||
|
||||
func _process(delta: float) -> bool:
|
||||
elapsed += delta
|
||||
match stage:
|
||||
0:
|
||||
# Wait one tick so Fleet._ready() has run and fleet.ships is
|
||||
# populated before we grab a ship reference.
|
||||
target_ship = fleet.ships[0]
|
||||
var asteroid_scene: PackedScene = load("res://Asteroid.tscn")
|
||||
asteroid = asteroid_scene.instantiate()
|
||||
asteroid.position = target_ship.position
|
||||
asteroid.velocity = Vector2.ZERO
|
||||
main_scene.add_child(asteroid)
|
||||
stage = 1
|
||||
elapsed = 0.0
|
||||
return false
|
||||
1:
|
||||
if elapsed < CHECK_DELAY:
|
||||
return false
|
||||
_check_results()
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _check_results() -> void:
|
||||
var ship_destroyed: bool = not is_instance_valid(target_ship)
|
||||
var ship_removed_from_fleet: bool = fleet.ships.find(target_ship) == -1
|
||||
var asteroid_destroyed: bool = not is_instance_valid(asteroid)
|
||||
|
||||
var ship_vfx_ok: bool = false
|
||||
var asteroid_vfx_ok: bool = false
|
||||
for child in root.get_children():
|
||||
if child is ShipExplosionVFX:
|
||||
ship_vfx_ok = true
|
||||
elif child is AsteroidExplosionVFX:
|
||||
asteroid_vfx_ok = true
|
||||
|
||||
print("ship_destroyed=%s ship_removed_from_fleet=%s asteroid_destroyed=%s ship_vfx_ok=%s asteroid_vfx_ok=%s" % [
|
||||
ship_destroyed, ship_removed_from_fleet, asteroid_destroyed, ship_vfx_ok, asteroid_vfx_ok
|
||||
])
|
||||
|
||||
if ship_destroyed and ship_removed_from_fleet and asteroid_destroyed and ship_vfx_ok and asteroid_vfx_ok:
|
||||
print("TEST_ASTEROID_SHIP_COLLISION: PASS")
|
||||
quit(0)
|
||||
else:
|
||||
print("TEST_ASTEROID_SHIP_COLLISION: FAIL")
|
||||
quit(1)
|
||||
Loading…
Reference in a new issue