diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-19 18:46:10 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-19 18:46:10 +0200 |
commit | 5f6b5490f80be9e792ccaeb18548cca54a62826f (patch) | |
tree | 029898cbaa860a060cb01b8db62c5b4414af8812 /src/ft_bad_boy_actions.c | |
parent | Minilibx update (diff) | |
download | 42-cub3d-5f6b5490f80be9e792ccaeb18548cca54a62826f.tar.gz 42-cub3d-5f6b5490f80be9e792ccaeb18548cca54a62826f.tar.bz2 42-cub3d-5f6b5490f80be9e792ccaeb18548cca54a62826f.tar.xz 42-cub3d-5f6b5490f80be9e792ccaeb18548cca54a62826f.tar.zst 42-cub3d-5f6b5490f80be9e792ccaeb18548cca54a62826f.zip |
Fixed enemy hitbox
Diffstat (limited to '')
-rw-r--r-- | src/ft_bad_boy_actions.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ft_bad_boy_actions.c b/src/ft_bad_boy_actions.c index fb2cdb7..4e332cc 100644 --- a/src/ft_bad_boy_actions.c +++ b/src/ft_bad_boy_actions.c @@ -14,6 +14,7 @@ #include <cub3d.h> #include <mlx.h> #include <stdlib.h> +#include <math.h> void ft_bb_wait(t_bad_boy *bl, t_sprite *sl, t_map *ml) @@ -46,16 +47,16 @@ void r = rand() % 4; sl->r = r; if (r == 0) - sl->s_pos_y += (FT_MOVE_SPEED * 1.5); + sl->s_pos_y += FT_ENMY_MOVE_SPEED; else if (r == 1) - sl->s_pos_y -= (FT_MOVE_SPEED * 1.5); + sl->s_pos_y -= FT_ENMY_MOVE_SPEED; else if (r == 2) - sl->s_pos_x -= (FT_MOVE_SPEED * 1.5); + sl->s_pos_x -= FT_ENMY_MOVE_SPEED; else if (r == 3) - sl->s_pos_x += (FT_MOVE_SPEED * 1.5); + sl->s_pos_x += FT_ENMY_MOVE_SPEED; ft_bb_collision(old_y, old_x, sl, ml); - ml->map[(uint64_t)old_y][(uint64_t)old_x] = '0'; - ml->map[(uint64_t)sl->s_pos_y][(uint64_t)sl->s_pos_x] = 'e'; + ml->map[llround(old_y)][llround(old_x)] = '0'; + ml->map[llround(sl->s_pos_y)][llround(sl->s_pos_x)] = 'e'; bl->does = 1; } |