diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_shoot.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/ft_shoot.c b/src/ft_shoot.c index 82c3017..229b9e9 100644 --- a/src/ft_shoot.c +++ b/src/ft_shoot.c @@ -14,6 +14,36 @@ #include <libft.h> static void + ft_hide_sprite(t_cub *cl) +{ + int64_t i; + int64_t j; + uint8_t stop; + + i = -1; + j = -1; + stop = 0; + while (++i < FT_TOTAL_SPRT - 5) + { + while (++j < 4096) + { + if (cl->sprites[i][j].s_pos_x == cl->rlist.sqy && + cl->sprites[i][j].s_pos_y == cl->rlist.sqx) + { + stop = 1; + break ; + } + } + if (stop == 1) + break ; + j = -1; + } + cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] = '0'; + cl->sprites[i][j].s_pos_x = 0; + cl->sprites[i][j].s_pos_y = 0; +} + +static void ft_hitscan(t_cub *cl, uint16_t hit) { while (hit == 0) @@ -34,8 +64,8 @@ static void cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy])) { hit = 1; - cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] = '0'; - ft_get_sprite_spawn(cl); + ft_hide_sprite(cl); + /* ft_get_sprite_spawn(cl); */ } else if (ft_ischarset("1", cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy])) |