aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_collision.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 16:22:57 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-02 16:22:57 +0200
commit88215b41b36ebae3e1d4afa6d12b5fb2e446f357 (patch)
treed0833199aee345a150c429f5327e0eb358242a44 /src/ft_collision.c
parentRevert this if needed, still sprites and collision to do (diff)
download42-cub3d-88215b41b36ebae3e1d4afa6d12b5fb2e446f357.tar.gz
42-cub3d-88215b41b36ebae3e1d4afa6d12b5fb2e446f357.tar.bz2
42-cub3d-88215b41b36ebae3e1d4afa6d12b5fb2e446f357.tar.xz
42-cub3d-88215b41b36ebae3e1d4afa6d12b5fb2e446f357.tar.zst
42-cub3d-88215b41b36ebae3e1d4afa6d12b5fb2e446f357.zip
Fixed coll now sprites, still revert if needed
Diffstat (limited to 'src/ft_collision.c')
-rw-r--r--src/ft_collision.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ft_collision.c b/src/ft_collision.c
index 859bfc3..385b2f7 100644
--- a/src/ft_collision.c
+++ b/src/ft_collision.c
@@ -23,11 +23,11 @@ static uint64_t
if (key == 0)
return (pl->pos_x + (pl->dir_x * FT_COLL_MULT));
else if (key == 1)
- return (pl->pos_x + (pl->dir_y * (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_x * FT_COLL_MULT));
else if (key == 3)
- return (pl->pos_x - (pl->dir_y * (FT_COLL_MULT / 2)));
+ return (pl->pos_x - (-pl->dir_y * (FT_COLL_MULT / 2)));
return ((uint64_t)pl->pos_x);
}
@@ -35,11 +35,11 @@ static uint64_t
ft_find_y(int32_t key, const t_player *pl)
{
if (key == 0)
- return (pl->pos_y + (pl->dir_y * FT_COLL_MULT));
+ return (pl->pos_y + (-pl->dir_y * FT_COLL_MULT));
else if (key == 1)
return (pl->pos_y - (pl->dir_x * (FT_COLL_MULT / 2)));
else if (key == 2)
- return (pl->pos_y - (pl->dir_y * FT_COLL_MULT));
+ return (pl->pos_y - (-pl->dir_y * FT_COLL_MULT));
else if (key == 3)
return (pl->pos_y + (pl->dir_x * (FT_COLL_MULT / 2)));
return ((uint64_t)pl->pos_y);