Fix boulder interaction on ladders
Fix also collision check for general entity overlapping a tilemain
parent
372a4da205
commit
523be15ead
|
@ -816,6 +816,8 @@ void tile_collision_system(Scene_t* scene)
|
||||||
for (unsigned int tile_x = tile_x1; tile_x <= tile_x2; tile_x++)
|
for (unsigned int tile_x = tile_x1; tile_x <= tile_x2; tile_x++)
|
||||||
{
|
{
|
||||||
unsigned int tile_idx = tile_y * tilemap.width + tile_x;
|
unsigned int tile_idx = tile_y * tilemap.width + tile_x;
|
||||||
|
|
||||||
|
// Tilemap collision check
|
||||||
if(tilemap.tiles[tile_idx].tile_type != EMPTY_TILE)
|
if(tilemap.tiles[tile_idx].tile_type != EMPTY_TILE)
|
||||||
{
|
{
|
||||||
Vector2 other;
|
Vector2 other;
|
||||||
|
@ -844,7 +846,7 @@ void tile_collision_system(Scene_t* scene)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
// Entity collision check
|
||||||
{
|
{
|
||||||
unsigned int other_ent_idx;
|
unsigned int other_ent_idx;
|
||||||
Entity_t* p_other_ent;
|
Entity_t* p_other_ent;
|
||||||
|
@ -1246,7 +1248,7 @@ void player_pushing_system(Scene_t* scene)
|
||||||
unsigned int tile_x = (point_to_check.x) / TILE_SIZE;
|
unsigned int tile_x = (point_to_check.x) / TILE_SIZE;
|
||||||
unsigned int tile_y = (point_to_check.y) / TILE_SIZE;
|
unsigned int tile_y = (point_to_check.y) / TILE_SIZE;
|
||||||
unsigned int tile_idx = tile_y * tilemap.width + tile_x;
|
unsigned int tile_idx = tile_y * tilemap.width + tile_x;
|
||||||
if(tilemap.tiles[tile_idx].tile_type != EMPTY_TILE) continue;
|
if(!tilemap.tiles[tile_idx].moveable) continue;
|
||||||
|
|
||||||
Entity_t* p_other_ent;
|
Entity_t* p_other_ent;
|
||||||
sc_map_foreach_value(&tilemap.tiles[tile_idx].entities_set, p_other_ent)
|
sc_map_foreach_value(&tilemap.tiles[tile_idx].entities_set, p_other_ent)
|
||||||
|
|
|
@ -411,6 +411,7 @@ void change_a_tile(TileGrid_t* tilemap, unsigned int tile_idx, TileType_t new_ty
|
||||||
tilemap->tiles[tile_idx].moveable = (
|
tilemap->tiles[tile_idx].moveable = (
|
||||||
tilemap->tiles[tile_idx].tile_type == EMPTY_TILE
|
tilemap->tiles[tile_idx].tile_type == EMPTY_TILE
|
||||||
|| tilemap->tiles[tile_idx].tile_type == SPIKES
|
|| tilemap->tiles[tile_idx].tile_type == SPIKES
|
||||||
|
|| tilemap->tiles[tile_idx].tile_type == LADDER
|
||||||
);
|
);
|
||||||
tilemap->tiles[tile_idx].def = (tilemap->tiles[tile_idx].tile_type == SOLID_TILE) ? 5: 2;
|
tilemap->tiles[tile_idx].def = (tilemap->tiles[tile_idx].tile_type == SOLID_TILE) ? 5: 2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue