Entity
This commit is contained in:
@@ -6,9 +6,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "direction.h"
|
||||
#include "entitydir.h"
|
||||
#include "entityanim.h"
|
||||
#include "rpg/entity/player.h"
|
||||
#include "npc.h"
|
||||
#include "rpg/world/worldpos.h"
|
||||
|
||||
#define ENTITY_COUNT 256
|
||||
|
||||
@@ -18,15 +20,19 @@ typedef enum {
|
||||
ENTITY_TYPE_NULL,
|
||||
ENTITY_TYPE_PLAYER,
|
||||
ENTITY_TYPE_NPC,
|
||||
|
||||
ENTITY_TYPE_COUNT
|
||||
} entitytype_t;
|
||||
|
||||
typedef struct entity_s {
|
||||
uint8_t id;
|
||||
entitytype_t type;
|
||||
direction_t direction;
|
||||
uint32_t position;// Tile index
|
||||
|
||||
// Movement
|
||||
entitydir_t direction;
|
||||
worldpos_t position;
|
||||
|
||||
entityanim_t animation;
|
||||
uint8_t animFrame;
|
||||
|
||||
union {
|
||||
player_t player;
|
||||
@@ -49,4 +55,20 @@ void entityInit(entity_t *entity, const entitytype_t type);
|
||||
*
|
||||
* @param entity Pointer to the entity structure to update.
|
||||
*/
|
||||
void entityUpdate(entity_t *entity);
|
||||
void entityUpdate(entity_t *entity);
|
||||
|
||||
/**
|
||||
* Turn an entity to face a new direction.
|
||||
*
|
||||
* @param entity Pointer to the entity to turn.
|
||||
* @param direction The direction to face.
|
||||
*/
|
||||
void entityTurn(entity_t *entity, const entitydir_t direction);
|
||||
|
||||
/**
|
||||
* Make an entity walk in a direction.
|
||||
*
|
||||
* @param entity Pointer to the entity to make walk.
|
||||
* @param direction The direction to walk in.
|
||||
*/
|
||||
void entityWalk(entity_t *entity, const entitydir_t direction);
|
||||
|
||||
Reference in New Issue
Block a user