entity dir

This commit is contained in:
2025-09-17 18:38:14 -05:00
parent f799690d3c
commit 08221af3f8
16 changed files with 369 additions and 58 deletions

View File

@@ -6,15 +6,15 @@
*/
#pragma once
// #include "direction.h"
#include "direction.h"
#include "rpg/entity/player.h"
#include "npc.h"
#include "physics/physics.h"
typedef struct {
void (*init)(entity_t *entity);
void (*update)(entity_t *entity);
} entitycallback_t;
#define ENTITY_FRICTION 0.9f
#define ENTITY_MIN_VELOCITY 0.05f
typedef struct map_s map_t;
typedef enum {
ENTITY_TYPE_NULL,
@@ -25,9 +25,9 @@ typedef enum {
} entitytype_t;
typedef struct entity_s {
// uint32_t id;// Completely unique ID for this entity.
map_t *map;
entitytype_t type;
// direction_t dir;
direction_t direction;
vec2 position;
vec2 velocity;
@@ -38,15 +38,14 @@ typedef struct entity_s {
};
} entity_t;
extern entitycallback_t ENTITY_CALLBACKS[ENTITY_TYPE_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);
void entityInit(entity_t *entity, const entitytype_t type, map_t *map);
/**
* Updates an entity.