/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_init_bad_boys.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: joelecle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:28:51 by joelecle #+# #+# */ /* Updated: 2020/02/14 17:28:51 by joelecle ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include /* ** bad_boy[].does list ** ------------------- ** 0: waiting ** 1: walking ** 2: firing ** 3: be dead */ int8_t ft_init_bad_boys(t_cub *cl) { int8_t i; if (!(cl->bad_boy = (t_bad_boy*)malloc(cl->mlist.sprite_nbr[13] * sizeof(t_bad_boy)))) return (ft_alloc_error(cl)); i = 0; while (i < cl->mlist.sprite_nbr[13]) { cl->bad_boy[i].life = FT_ENMY_STRT_LIFE; cl->bad_boy[i].does = 0; cl->bad_boy[i].sleep = 0; cl->bad_boy[i].isdead = 0; cl->bad_boy[i].act[0] = ft_bb_wait; cl->bad_boy[i].act[1] = ft_bb_walk; cl->bad_boy[i].act[2] = ft_bb_fire; i++; } return (0); }