aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_collision.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 14:24:57 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 14:24:57 +0200
commit8a695d62dcb9b8783918263f962b986df20310f2 (patch)
tree37e3c4e286abcec481bbc8169c7297e1ec07b578 /src/ft_collision.c
parentLater (diff)
download42-cub3d-8a695d62dcb9b8783918263f962b986df20310f2.tar.gz
42-cub3d-8a695d62dcb9b8783918263f962b986df20310f2.tar.bz2
42-cub3d-8a695d62dcb9b8783918263f962b986df20310f2.tar.xz
42-cub3d-8a695d62dcb9b8783918263f962b986df20310f2.tar.zst
42-cub3d-8a695d62dcb9b8783918263f962b986df20310f2.zip
Correct dir_x dir_y sqy sqx
Diffstat (limited to '')
-rw-r--r--src/ft_collision.c16
1 files changed, 8 insertions, 8 deletions
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);
}