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
42
EnemySpawner.gd
Normal file
42
EnemySpawner.gd
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
extends Node2D
|
||||
|
||||
@export var min_spawn_interval: float = 3.0
|
||||
@export var max_spawn_interval: float = 6.0
|
||||
@export var spawn_margin: float = 150.0
|
||||
|
||||
@onready var fleet: Node2D = get_node("../Fleet")
|
||||
|
||||
var enemy_scene: PackedScene = preload("res://Enemy.tscn")
|
||||
var timer: float = 0.0
|
||||
var next_spawn_time: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
randomize()
|
||||
_reset_timer()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
timer += delta
|
||||
if timer >= next_spawn_time:
|
||||
timer = 0.0
|
||||
_reset_timer()
|
||||
_spawn_enemy()
|
||||
|
||||
|
||||
func _reset_timer() -> void:
|
||||
next_spawn_time = randf_range(min_spawn_interval, max_spawn_interval)
|
||||
|
||||
|
||||
func _spawn_enemy() -> void:
|
||||
if fleet.ships.is_empty():
|
||||
return
|
||||
|
||||
var visible_rect: Rect2 = ViewUtils.get_visible_world_rect(self)
|
||||
var radius: float = visible_rect.size.length() / 2.0 + spawn_margin
|
||||
var angle: float = randf() * TAU
|
||||
var spawn_pos: Vector2 = fleet.get_centroid() + Vector2(cos(angle), sin(angle)) * radius
|
||||
|
||||
var enemy: Node2D = enemy_scene.instantiate()
|
||||
enemy.position = spawn_pos
|
||||
get_parent().add_child(enemy)
|
||||
Loading…
Reference in a new issue