diff --git a/Physics_Move.c b/Physics_Move.c index f1a88d7..7814184 100644 --- a/Physics_Move.c +++ b/Physics_Move.c @@ -5,6 +5,7 @@ #include "util/tree.h" #include +#include static inline double dabs(double x) { @@ -35,10 +36,12 @@ void _physics_MoveX(System_Physics *sys, Entity *e, Duration deltaTime) { call_hithandler(e, tohit_comp->super, vec2(delta, 0), e->hitbox->onHitData); if (delta > 0) { // Moves right, hits left edge + fprintf(stderr, "hit left edge"); double maxdelta = tohit.lefttop.x - mybox.lefttop.x - mybox.size.x; delta = maxdelta - EPS; } else { // Moves left, hits right edge + fprintf(stderr, "hit right edge"); double maxdelta = tohit.lefttop.x - mybox.lefttop.x + tohit.size.x; delta = maxdelta + EPS; } diff --git a/Player_Component.c b/Player_Component.c index fde7b2e..1bffe3b 100644 --- a/Player_Component.c +++ b/Player_Component.c @@ -16,6 +16,7 @@ static inline double dabs(double x) { System_Player *player_NewSystem(App *super) { System_Player *sys = malloc(sizeof(System_Player)); sys->super = super; + sys->player = NULL; return sys; } void player_DeleteSystem(System_Player *sys) { diff --git a/util/tree.c b/util/tree.c index 293ac45..9235193 100644 --- a/util/tree.c +++ b/util/tree.c @@ -131,7 +131,7 @@ tree_Node *tree_FirstNode(tree_Tree *tree) { tree_Node *result = tree->root; if (!result) return 0; - while (result->right) + while (result->left) result = result->left; return result; }