Files
skevity/source/game_source/entity.c

22 lines
522 B
C

#include "entity.h"
#include "cells.h"
#include "vector.h"
#include "world.h"
int EntityMove(entity* e, vec2 pos) {
world* world = e->world;
if(world->wells[at(pos.x,pos.y, world)].cell->flags & (CELL_FLAG_BLOCKING)){
return 1;
}
if(world->wells[at(pos.x,pos.y, world)].entityIds[0] != NULL){
return 2;
}
world->wells[at(e->position.x,e->position.y, world)].entityIds[0] = 0;
world->wells[at(pos.x,pos.y, world)].entityIds[0] = e;
e->position = pos;
return 0;
}