diff options
-rw-r--r-- | src/ft_draw_sprite_extra.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 00e295e..81b299d 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -13,6 +13,7 @@ #include <cub3d.h> #include <stdint.h> #include <stdlib.h> +#include <math.h> void ft_sprite_h_w(t_cub *cl, t_sprite *sprite) @@ -49,6 +50,7 @@ static void (1 + sprite->transformx / sprite->transformy); } +#include <stdio.h> void ft_calc_sprite(t_cub *cl) { @@ -60,6 +62,9 @@ void while (++i < cl->big_t_val) { sprite = cl->sprites[(int8_t)cl->big_t[i][2]][(int32_t)cl->big_t[i][3]]; + if (((cl->plist.pos_x > sprite.s_pos_x - 0.01 && cl->plist.pos_x < sprite.s_pos_x + 0.99) && + (cl->plist.pos_y > sprite.s_pos_y - 0.01 && cl->plist.pos_y < sprite.s_pos_y + 0.99))) + return ; if (sprite.s_pos_x != 0) { sprite.current_sprite = (int8_t)cl->big_t[i][1]; |