From 8a695d62dcb9b8783918263f962b986df20310f2 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 2 Apr 2020 14:24:57 +0200 Subject: Correct dir_x dir_y sqy sqx --- src/ft_collision.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ft_collision.c') diff --git a/src/ft_collision.c b/src/ft_collision.c index 00dab1f..859bfc3 100644 --- a/src/ft_collision.c +++ b/src/ft_collision.c @@ -21,13 +21,13 @@ static uint64_t ft_find_x(int32_t key, const t_player *pl) { if (key == 0) - return (pl->pos_x + (pl->dir_y * FT_COLL_MULT)); + return (pl->pos_x + (pl->dir_x * FT_COLL_MULT)); else if (key == 1) - return (pl->pos_x + (pl->dir_x * (FT_COLL_MULT / 2))); + return (pl->pos_x + (pl->dir_y * (FT_COLL_MULT / 2))); else if (key == 2) - return (pl->pos_x - (pl->dir_y * FT_COLL_MULT)); + return (pl->pos_x - (pl->dir_x * FT_COLL_MULT)); else if (key == 3) - return (pl->pos_x - (pl->dir_x * (FT_COLL_MULT / 2))); + return (pl->pos_x - (pl->dir_y * (FT_COLL_MULT / 2))); return ((uint64_t)pl->pos_x); } @@ -35,13 +35,13 @@ static uint64_t ft_find_y(int32_t key, const t_player *pl) { if (key == 0) - return (pl->pos_y + (pl->dir_x * FT_COLL_MULT)); + return (pl->pos_y + (pl->dir_y * FT_COLL_MULT)); else if (key == 1) - return (pl->pos_y - (pl->dir_y * (FT_COLL_MULT / 2))); + return (pl->pos_y - (pl->dir_x * (FT_COLL_MULT / 2))); else if (key == 2) - return (pl->pos_y - (pl->dir_x * FT_COLL_MULT)); + return (pl->pos_y - (pl->dir_y * FT_COLL_MULT)); else if (key == 3) - return (pl->pos_y + (pl->dir_y * (FT_COLL_MULT / 2))); + return (pl->pos_y + (pl->dir_x * (FT_COLL_MULT / 2))); return ((uint64_t)pl->pos_y); } -- cgit v1.2.3