diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-31 14:59:53 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-31 14:59:53 +0200 |
commit | f06a9f89bdbf5123fd00a79d350d599509d689df (patch) | |
tree | 396f94876a3d81f14c9cab3b06989c13cc8e6437 /src/ft_damage_bad_boy.c | |
parent | Fixed that gangsta (diff) | |
download | 42-cub3d-f06a9f89bdbf5123fd00a79d350d599509d689df.tar.gz 42-cub3d-f06a9f89bdbf5123fd00a79d350d599509d689df.tar.bz2 42-cub3d-f06a9f89bdbf5123fd00a79d350d599509d689df.tar.xz 42-cub3d-f06a9f89bdbf5123fd00a79d350d599509d689df.tar.zst 42-cub3d-f06a9f89bdbf5123fd00a79d350d599509d689df.zip |
Big gameplay
Diffstat (limited to 'src/ft_damage_bad_boy.c')
-rw-r--r-- | src/ft_damage_bad_boy.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/ft_damage_bad_boy.c b/src/ft_damage_bad_boy.c new file mode 100644 index 0000000..c8a04fa --- /dev/null +++ b/src/ft_damage_bad_boy.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_damage_bad_boy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:32 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> + +static uint8_t + ft_get_bad_boy_id(t_cub *cl) +{ + uint8_t i; + + i = 0; + while (i < cl->mlist.sprite_nbr[13]) + { + if (cl->sprites[13][i].s_pos_x == cl->rlist.sqy && + cl->sprites[13][i].s_pos_y == cl->rlist.sqx) + return (i); + i++; + } + return (0); +} + +void + ft_damage_bad_boy(t_cub *cl) +{ + uint8_t id; + + id = ft_get_bad_boy_id(cl); + if (cl->plist.handles_weapon == 0) + cl->bad_boy[id].life -= FT_W_ONE_DANAGE_AMOUNT; + else if (cl->plist.handles_weapon == 1) + cl->bad_boy[id].life -= FT_W_TWO_DANAGE_AMOUNT; + else if (cl->plist.handles_weapon == 2) + cl->bad_boy[id].life -= FT_W_THREE_DANAGE_AMOUNT; + /* TODO: sfx enemy scream and death */ +} |