remaking entire collsion system

This commit is contained in:
Andrew Haynes Macbook
2026-01-25 15:37:54 -05:00
parent a3589fd93d
commit 3159efb257
4 changed files with 240 additions and 243 deletions
+10 -9
View File
@@ -27,8 +27,9 @@ class Object
{
public:
Object(ObjectData data);
CollisionDir find_intersection(Object& entity);
// CollisionDir find_intersection(Object& entity);
float find_horizontal_difference_from_interesection(Object& entity);
float find_intersection(Object &entity);
sf::RectangleShape rect;
};
@@ -62,17 +63,17 @@ class Player : public Entity
void update_bounding_box();
int check_bounding_box(
std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
void handle_movment(Timer& dash);
void handle_movment(Timer& dash, std::array<std::array<std::unique_ptr<Object>, 19>, 13> &tilemap);
void handle_gravity();
bool get_jumping();
void horizontal_no_out_of_bounds();
void vertical_no_out_of_bounds(Entity& base);
bool get_horizontal_collision(
std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
bool get_vertical_top_collision(
std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
bool get_vertical_bottom_collision(
std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
void vertical_no_out_of_bounds();
// bool get_horizontal_collision(
// std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
// bool get_vertical_top_collision(
// std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
// bool get_vertical_bottom_collision(
// std::array<std::array<std::unique_ptr<Object>, MAX_COLS>, MAX_ROWS>& tilemap);
private:
sf::Vector2f _min_velocity { 0, 0 };