Files
major_tom/src/game/powerup.h
Thomas fac7085056 Add moon surface intro level with asteroid hazards and unarmed mechanics
Introduce moon01.lvl as the starting level — a pure jump-and-run intro
with no gun and no enemies, just platforming over gaps and dodging falling
asteroids. The player picks up their gun upon transitioning to level01.

New features:
- Moon tileset and PARALLAX_STYLE_MOON with crater terrain backgrounds
- Asteroid entity (ENT_ASTEROID): falls from sky, damages on contact,
  explodes on ground with particles, respawns after delay
- PLAYER_UNARMED directive disables gun for the level
- Pit rescue mechanic: falling costs 1 HP and auto-dashes upward
- Gun powerup entity type for future armed-pickup levels
- Segment-based procedural level generator with themed rooms
- Extended editor with entity palette and improved tile cycling
- Web shell improvements for Emscripten builds
2026-03-01 09:20:49 +00:00

43 lines
1.4 KiB
C

#ifndef JNR_POWERUP_H
#define JNR_POWERUP_H
#include "engine/entity.h"
/* ═══════════════════════════════════════════════════
* Powerup Pickups
*
* Small collectible items that grant the player
* an instant benefit on contact:
* - Health: restores 1 HP
* - Jetpack: instantly refills all dash charges
* - Drone: spawns an orbiting combat drone
* ═══════════════════════════════════════════════════ */
typedef enum PowerupKind {
POWERUP_HEALTH,
POWERUP_JETPACK,
POWERUP_DRONE,
POWERUP_GUN,
POWERUP_KIND_COUNT
} PowerupKind;
typedef struct PowerupData {
PowerupKind kind;
float bob_timer; /* sine bob animation */
Vec2 base_pos; /* original spawn position */
} PowerupData;
/* Register the powerup entity type */
void powerup_register(EntityManager *em);
/* Spawn a specific powerup at a position */
Entity *powerup_spawn(EntityManager *em, Vec2 pos, PowerupKind kind);
/* Convenience spawners for level/levelgen */
Entity *powerup_spawn_health(EntityManager *em, Vec2 pos);
Entity *powerup_spawn_jetpack(EntityManager *em, Vec2 pos);
Entity *powerup_spawn_drone(EntityManager *em, Vec2 pos);
Entity *powerup_spawn_gun(EntityManager *em, Vec2 pos);
#endif /* JNR_POWERUP_H */