RogueLife/src/enemies.h

51 lines
1.2 KiB
C
Raw Normal View History

2021-06-15 17:27:30 +02:00
//---
// enemies: List of enemies and their properties
//---
#pragma once
#include "geometry.h"
#include "anim.h"
#include "entities.h"
/* enemy_stat_t: Statistic base and growth */
typedef struct {
/* Base value at level 1 */
fixed_t base;
/* Initial per-level growth */
fixed_t growth;
/* Per-level increase of growth */
fixed_t affinity;
} enemy_stat_t;
2021-06-15 17:27:30 +02:00
/* enemy_t: Static enemy information */
typedef struct {
/* Enemy name (showed in wave information) */
char const *name;
/* Map hitbox (represents ground size, collides with walls) */
frect_t hitbox;
/* Sprite hitbox (interacts with attacks and effect areas) */
frect_t sprite;
2021-08-15 11:05:04 +02:00
/* Idle animation, death animation, damage animation */
2021-10-23 17:14:59 +02:00
anim_frame_t *anim_idle[2], *anim_walking[2], *anim_hit[2], *anim_death[2];
2021-06-15 17:27:30 +02:00
/* Movement parameters */
entity_movement_params_t movement_params;
/* Statistics model */
enemy_stat_t HP, ATK, DEF;
2021-06-15 17:27:30 +02:00
} enemy_t;
/* List of enemies */
enum {
/* ID 0 is used for the player! */
ENEMY_SLIME = 1,
2021-06-25 12:07:22 +02:00
ENEMY_BAT = 2,
2021-06-15 17:27:30 +02:00
};
2021-06-25 12:07:22 +02:00
/* Array of enemy data */
extern enemy_t const * const enemies[];
2021-06-15 17:27:30 +02:00
/* Create a new enemy of the given type. */
entity_t *enemy_spawn(int enemy_id, int level);