diff options
Diffstat (limited to 'src/ft_bad_boy_actions.c')
-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; } |