diff --git a/include/components/collision_component.h b/include/components/collision_component.h index 559c3cf..5399f9a 100644 --- a/include/components/collision_component.h +++ b/include/components/collision_component.h @@ -10,10 +10,10 @@ struct collision_component { gc_component base; - int distance_down; - int distance_top; - int distance_left; - int distance_right; + float distance_down; + float distance_top; + float distance_left; + float distance_right; }; extern const struct collision_component collision_component; \ No newline at end of file diff --git a/include/quadtree.h b/include/quadtree.h index cd485fb..fef2de9 100644 --- a/include/quadtree.h +++ b/include/quadtree.h @@ -15,8 +15,8 @@ typedef struct quadtree quadtree; typedef struct qt_intrect { - int x; - int y; + float x; + float y; int h; int w; } qt_intrect; @@ -29,10 +29,10 @@ typedef struct qt_object typedef struct qt_collision { - int distance_left; - int distance_right; - int distance_top; - int distance_down; + float distance_left; + float distance_right; + float distance_top; + float distance_down; } qt_collision; struct quadtree diff --git a/src/systems/movable_system.c b/src/systems/movable_system.c index f81f290..1d5fd40 100644 --- a/src/systems/movable_system.c +++ b/src/systems/movable_system.c @@ -17,6 +17,8 @@ #include "systems/movable_system.h" #include +#include "components/controllable_component.h" + static void update_entity(gc_engine *engine __attribute__((unused)), \ void *system __attribute__((unused)), gc_entity *entity, float dtime) { @@ -31,8 +33,6 @@ void *system __attribute__((unused)), gc_entity *entity, float dtime) if (mov->velocity.y < 0) pos->position.y -= MIN(mov->velocity.y * -dtime, col->distance_down); else { - // if (mov->velocity.y != 0) - // printf("Velocity y: %4.0f, Moving up of %4.0f\n", mov->velocity.y, mov->velocity.y * dtime); pos->position.y += MIN(mov->velocity.y * dtime, col->distance_top); } if (col->distance_left == 0 || col->distance_right == 0)