feat: load zombie sprites from map

This commit is contained in:
Khaïs COLIN 2025-08-18 13:21:52 +02:00
parent 8445f240a2
commit 5242679d95
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
7 changed files with 92 additions and 17 deletions

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* create_sprite.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/12 15:43:19 by tchampio #+# #+# */
/* Updated: 2025/08/18 12:55:21 by tchampio ### ########.fr */
/* Created: 2025/08/18 13:52:23 by kcolin #+# #+# */
/* Updated: 2025/08/18 13:55:08 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,7 +16,7 @@
#include "../utils/inits.h"
t_sprite *create_sprite(t_cub3d_data *data, char *texture,
double x, double y)
double x, double y, t_sprite_type type)
{
t_sprite *sprite;
@ -25,7 +25,7 @@ t_sprite *create_sprite(t_cub3d_data *data, char *texture,
return (NULL);
sprite->x = x;
sprite->y = y;
sprite->sprite_type = OTHER;
sprite->sprite_type = type;
sprite->image = load_single_texture(data, texture);
return (sprite);
}
@ -35,15 +35,18 @@ t_sprite *place_right_sprite(t_cub3d_data *data, char c, double x, double y)
t_sprite *sprite;
if (c == 'M')
sprite = create_sprite(data, MYSTERY_TEX, x + 0.5, y + 0.5);
sprite = create_sprite(data, MYSTERY_TEX, x + 0.5, y + 0.5, OTHER);
if (c == 'Q')
sprite = create_sprite(data,
REV_TEX, x + 0.5, y + 0.5);
REV_TEX, x + 0.5, y + 0.5, OTHER);
if (c == 'J')
sprite = create_sprite(data,
JUGG_TEX, x + 0.5, y + 0.5);
JUGG_TEX, x + 0.5, y + 0.5, OTHER);
if (c == 'D')
sprite = create_sprite(data,
DBLTAP_TEX, x + 0.5, y + 0.5);
DBLTAP_TEX, x + 0.5, y + 0.5, OTHER);
if (c == 'z')
sprite = create_sprite(data,
ZOMBIE_TEX, x + 0.5, y + 0.5, ZOMBIE);
return (sprite);
}