Colisiones básicas completadas

This commit is contained in:
2022-08-17 13:26:22 +02:00
parent a6d6f2854e
commit 9bd1e9b936
11 changed files with 115 additions and 41 deletions

View File

@@ -224,12 +224,13 @@ void Map::render()
t_tile_map Map::getTile(SDL_Point p)
{
const int tile = tilemap[((p.y / tile_width) * map_width) + (p.x / tile_width)];
const int png_width = 16;
if (tile > 0 && tile < 4 * map_width * tile_width)
if (tile >= 0 && tile < 4 * png_width)
{
return nothing;
}
else if (tile > (4 * map_width * tile_width) && tile < 8 * map_width * tile_width)
else if (tile >= (4 * png_width) && tile < 8 * png_width)
{
return wall;
}