This commit is contained in:
2025-10-08 14:17:58 -05:00
parent 46f820690d
commit 67604eca8d
17 changed files with 230 additions and 165 deletions

View File

@@ -10,9 +10,11 @@
#include "rpg/entity/player.h"
#include "npc.h"
#include "physics/physics.h"
#include "rpg/world/worldunit.h"
#define ENTITY_FRICTION 0.9f
#define ENTITY_MIN_VELOCITY 0.05f
#define ENTITY_FRICTION 1
#define ENTITY_MIN_VELOCITY 1
#define ENTITY_COUNT 256
typedef struct map_s map_t;
@@ -25,12 +27,10 @@ typedef enum {
} entitytype_t;
typedef struct entity_s {
map_t *map;
entitytype_t type;
direction_t direction;
vec2 position;
vec2 velocity;
worldchunkpos_t position[3];
worldsubtile_t velocity[3];
union {
player_t player;
@@ -38,14 +38,15 @@ typedef struct entity_s {
};
} entity_t;
extern entity_t ENTITIES[ENTITY_COUNT];
/**
* Initializes an entity structure.
*
* @param entity Pointer to the entity structure to initialize.
* @param type The type of the entity.
* @param map Pointer to the map the entity belongs to.
*/
void entityInit(entity_t *entity, const entitytype_t type, map_t *map);
void entityInit(entity_t *entity, const entitytype_t type);
/**
* Updates an entity.