Add spacecraft exit sequence at level exit zones

Spawn an exit ship when the player approaches an exit zone. The ship
flies in, lands near the exit, and waits for the player to board.
On boarding the player is deactivated, the ship takes off, and the
level transition fires after departure.
This commit is contained in:
Thomas
2026-03-01 12:38:41 +00:00
parent 98d2e87bb3
commit ded662b42a
5 changed files with 232 additions and 30 deletions

View File

@@ -55,9 +55,14 @@ typedef struct SpacecraftData {
void spacecraft_register(EntityManager *em);
/* Spawn a spacecraft that will fly in and land at the given position.
* The position is the bottom-center of where the ship should land. */
* The position is the top-left of where the ship should rest (from .lvl ENTITY). */
Entity *spacecraft_spawn(EntityManager *em, Vec2 land_pos);
/* Spawn an exit spacecraft that flies in from the right and lands at the
* given position. Used for the level-exit sequence. The is_exit_ship flag
* is set to true so level code can identify this ship. */
Entity *spacecraft_spawn_exit(EntityManager *em, Vec2 land_pos);
/* Trigger takeoff on an existing landed spacecraft */
void spacecraft_takeoff(Entity *ship);
@@ -67,4 +72,7 @@ bool spacecraft_is_done(const Entity *ship);
/* Check if the spacecraft is in the landed state */
bool spacecraft_is_landed(const Entity *ship);
/* Check if this is the exit ship */
bool spacecraft_is_exit_ship(const Entity *ship);
#endif /* JNR_SPACECRAFT_H */