wall merging
This commit is contained in:
+6
-1
@@ -23,7 +23,7 @@ int main() {
|
||||
sf::Vector2<float> size { TILESIZE / 2.0f, TILESIZE / 2.0f };
|
||||
sf::Vector2<float> pos { TILESIZE, TILESIZE };
|
||||
float acceleration { 1.0f };
|
||||
float max_velocity_y { 20.0f };
|
||||
float max_velocity_y { 15.0f };
|
||||
float border_size { -1.0f };
|
||||
float dash_distance { 20.0f };
|
||||
sf::Vector2f velocity { 4.0f, 0 };
|
||||
@@ -53,6 +53,8 @@ int main() {
|
||||
wall_list[i][j] = new Entity { tile_data.size, tile_data.pos, tile_data.velocity, tile_data.border_size, sf::Color::Black };
|
||||
}
|
||||
|
||||
merged_walls(wall_list);
|
||||
|
||||
for(auto[i, j] : std::views::cartesian_product(std::views::iota(0, MAX_ROWS), std::views::iota(0, MAX_COLS))) {
|
||||
if(wall_list[i][j] == nullptr) continue;
|
||||
wall_list[i][j]->rect.setPosition({ (j * tile_data.size.x), (i * tile_data.size.y) });
|
||||
@@ -106,6 +108,9 @@ int main() {
|
||||
// }
|
||||
|
||||
player.handle_gravity();
|
||||
if(player.get_velocity().y > ((float)TILESIZE / 2)) {
|
||||
player.set_velocity_y(TILESIZE / 2);
|
||||
}
|
||||
if(!player.get_vertical_bottom_collision(wall_list)) {
|
||||
player.get_vertical_top_collision(wall_list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user