aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_select_bad_boy_action.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-30 17:46:28 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-30 17:46:28 +0200
commitdf8d32e84a60558c38a0d75496c82de657103648 (patch)
tree964706cdd49ea979e42eef21dfa6f5af4299a7ce /src/ft_select_bad_boy_action.c
parentCommit (diff)
download42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.gz
42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.bz2
42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.xz
42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.tar.zst
42-cub3d-df8d32e84a60558c38a0d75496c82de657103648.zip
It's moving!
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++;
+ }
+}