Initial commit.

This commit is contained in:
2025-10-26 15:42:34 -05:00
commit f1db7de87c
29 changed files with 781 additions and 0 deletions

48
src/entity/entity.c Executable file
View File

@@ -0,0 +1,48 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "entity.h"
void entityInit(entity_t *entity, const entitytype_t type) {
memset(entity, 0, sizeof(entity_t));
entity->type = type;
}
void entityTick(entity_t *entity) {
if(entity->type == ENTITY_TYPE_NULL) return;
// Let entities move (if they do)
if(entity->type == ENTITY_TYPE_PLAYER) {
playerTickInput(entity);
}
}
void entityTurn(entity_t *entity, const direction_t direction) {
// TODO: animation/delay.
entity->direction = direction;
}
void entityWalk(entity_t *entity, const direction_t direction) {
// TODO: Animation, delay, colission, result, etc.
entity->direction = direction;
switch(direction) {
case DIRECTION_NORTH:
entity->position.y--;
break;
case DIRECTION_EAST:
entity->position.x++;
break;
case DIRECTION_SOUTH:
entity->position.y++;
break;
case DIRECTION_WEST:
entity->position.x--;
break;
}
}