diff options
Diffstat (limited to 'src/ft_init_bad_boys.c')
-rw-r--r-- | src/ft_init_bad_boys.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ft_init_bad_boys.c b/src/ft_init_bad_boys.c new file mode 100644 index 0000000..8ddc9a5 --- /dev/null +++ b/src/ft_init_bad_boys.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_init_bad_boys.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:51 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:51 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> +#include <stdlib.h> + +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 = 5; + cl->bad_boy[i].does = 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); +} |