forked from tas/major_tom
Initial commit
This commit is contained in:
47
src/game/enemy.h
Normal file
47
src/game/enemy.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef JNR_ENEMY_H
|
||||
#define JNR_ENEMY_H
|
||||
|
||||
#include "engine/entity.h"
|
||||
#include "engine/camera.h"
|
||||
#include "engine/tilemap.h"
|
||||
|
||||
/* ── Grunt enemy ───────────────────────────────────── */
|
||||
/* A ground-patrolling enemy that walks back and forth */
|
||||
|
||||
#define GRUNT_WIDTH 12
|
||||
#define GRUNT_HEIGHT 16
|
||||
#define GRUNT_SPEED 40.0f /* horizontal walk speed (px/s) */
|
||||
#define GRUNT_HEALTH 2
|
||||
|
||||
typedef struct GruntData {
|
||||
float patrol_dir; /* 1.0 or -1.0 */
|
||||
float death_timer; /* countdown after dying */
|
||||
} GruntData;
|
||||
|
||||
void grunt_register(EntityManager *em);
|
||||
Entity *grunt_spawn(EntityManager *em, Vec2 pos);
|
||||
|
||||
/* ── Flyer enemy ───────────────────────────────────── */
|
||||
/* A flying enemy that bobs up and down, moves toward */
|
||||
/* the player when in range */
|
||||
|
||||
#define FLYER_WIDTH 14
|
||||
#define FLYER_HEIGHT 12
|
||||
#define FLYER_SPEED 50.0f /* horizontal chase speed (px/s) */
|
||||
#define FLYER_BOB_AMP 20.0f /* vertical bob amplitude */
|
||||
#define FLYER_BOB_SPD 2.5f /* bob frequency (radians/s) */
|
||||
#define FLYER_HEALTH 1
|
||||
#define FLYER_DETECT 120.0f /* detection range (px) */
|
||||
#define FLYER_SHOOT_CD 2.0f /* seconds between shots */
|
||||
|
||||
typedef struct FlyerData {
|
||||
float bob_timer; /* for sine wave bobbing */
|
||||
float base_y; /* original y position */
|
||||
float death_timer;
|
||||
float shoot_timer; /* cooldown for shooting */
|
||||
} FlyerData;
|
||||
|
||||
void flyer_register(EntityManager *em);
|
||||
Entity *flyer_spawn(EntityManager *em, Vec2 pos);
|
||||
|
||||
#endif /* JNR_ENEMY_H */
|
||||
Reference in New Issue
Block a user