mirror of https://github.com/bgiraudr/Adoranda.git
16 lines
476 B
C
16 lines
476 B
C
#include "map.h"
|
|
#include "engine.h"
|
|
#include "player.h"
|
|
|
|
/*check if a tile is walkable*/
|
|
int map_walkable(struct Map const *map, int x, int y) {
|
|
int tile = map->info_map[x + map->w * y];
|
|
if(x < 0 || x > map->w-1 || y < 0 || y > map->h-1) return 0;
|
|
return (tile != TILE_SOLID && tile != TILE_CHARACTER);
|
|
}
|
|
|
|
/*get the tile under the player*/
|
|
int map_get_player_tile(struct Game const *game) {
|
|
return game->map->info_map[game->player->x + game->map->w * game->player->y];
|
|
}
|