aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_select_bad_boy_action.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_select_bad_boy_action.c')
-rw-r--r--src/ft_select_bad_boy_action.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/ft_select_bad_boy_action.c b/src/ft_select_bad_boy_action.c
new file mode 100644
index 0000000..6b3d2ef
--- /dev/null
+++ b/src/ft_select_bad_boy_action.c
@@ -0,0 +1,35 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_select_bad_boy_actions.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 <stdlib.h>
+
+void
+ ft_select_bad_boy_action(t_cub *cl)
+{
+ int8_t i;
+ int8_t r;
+
+ i = 0;
+ while (i < cl->mlist.sprite_nbr[13])
+ {
+ if (cl->bad_boy[i].sleep == 0 && cl->bad_boy[i].life > 0)
+ {
+ r = rand() % 2;
+ cl->bad_boy[i].act[r](&cl->bad_boy[i],
+ &cl->sprites[13][i], &cl->mlist);
+ cl->bad_boy[i].sleep = 1;
+ }
+ i++;
+ }
+}