enemies on config

This commit is contained in:
Willem Haffmans 2025-05-28 23:00:35 +02:00
parent ede0cd6f68
commit fb1e7979d9
3 changed files with 28 additions and 22 deletions

View File

@ -1,12 +1,12 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2025/05/28 17:48:28 by qmennen ### ########.fr #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: whaffman <whaffman@student.codam.nl> +#+ #
# +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2025/05/28 18:53:50 by whaffman ######## odam.nl #
# #
# **************************************************************************** #
@ -53,7 +53,7 @@ debug_CFLAGS = -Wall -Werror -Werror -g3 -DDEBUG -DDBG='fprintf(stderr, RED "DEB
asan_CFLAGS = -Wall -Werror -Werror -fsanitize=address,leak,undefined -g3
tsan_CFLAGS = -Wall -Werror -Werror -fsanitize=thread -g3
RUN_ARGS=monster.cub
RUN_ARGS=test.cub
# Targets for each build configuration
define BUILD_TARGETS

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_config_line.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/22 13:10:06 by whaffman #+# #+# */
/* Updated: 2025/05/28 17:32:08 by qmennen ### ########.fr */
/* :::::::: */
/* parse_config_line.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/22 13:10:06 by whaffman #+# #+# */
/* Updated: 2025/05/28 19:03:24 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -109,11 +109,16 @@ int handle_sprite(char *token, t_map *map)
sprite.collectible = 1;
sprite.type = SPRITE_TYPE_COLLECTIBLE;
}
else
else if (token[1] == 'e')
{
sprite.collectible = 0;
sprite.type = SPRITE_TYPE_ENEMY;
}
else
{
sprite.collectible = 0;
sprite.type = SPRITE_TYPE_DEFAULT;
}
symbol = *ft_strtok(NULL, " ");
if (symbol < 'a' || symbol > 'z')
return (ft_putstr_fd("Error: Invalid sprite symbol\n", 2), FAILURE);
@ -135,12 +140,12 @@ int handle_sprite(char *token, t_map *map)
t_token_handler handle_config_token(const char *token, t_map *map)
{
const char *config_tokens[] = {
"NO", "SO", "WE", "EA", "F", "C", "FT", "CT", "-c", "-s", NULL
"NO", "SO", "WE", "EA", "F", "C", "FT", "CT", "-c", "-s", "-e", NULL
};
const t_token_handler handlers[] = {
handle_wall, handle_wall, handle_wall, handle_wall,
handle_fc_color, handle_fc_color, handle_fc_texture, handle_fc_texture,
handle_sprite, handle_sprite, NULL
handle_sprite, handle_sprite, handle_sprite, NULL
};
int i;

View File

@ -18,17 +18,18 @@ CT ./assets/ceiling64x64.png
-s a ./assets/lamp.png
-c b ./assets/accu.png
-s p ./assets/plant.png
-s g ./assets/mushroom.png
-e g ./assets/mushroom.png
-s m ./assets/broken_mirror.png
-s t ./assets/test.png
-e e ./assets/flying_eye.png
1111111 111 1111 111111 1111111111 111111
1000001110111001 100001 1000000001 10001
1001000g000b0001 100001 100000110111100011
1001000g000b0e01 100001 100000110111100011
10b0001110000001110011111111 1100b0001000000001
1000001 1000100a000010000001 10000000100b000001
1000001 1000100a000010000001 100000e0100b000001
100m00111000100000b00000b00111110p00000100p00m001
10b000bb00001111111111100000000000111111000000001
10b0e0bb00001111111111100000000000111111000000001
1000t0bW00001 1000011111111 1000001001
10p0011111001 111111100001 1111111111110001
100001 1001 1p00000000011111111000010111 10b01