From 3ad8aa9e66f7e159b175a9a52e5ad00bbfd90734 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Mon, 20 May 2024 20:30:41 +0200 Subject: Add collectibles Exit now only works after collecting everything. I don't really like my current solution, but it works for now. --- src/draw.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/draw.c') diff --git a/src/draw.c b/src/draw.c index 4e7e4e8..5284d74 100644 --- a/src/draw.c +++ b/src/draw.c @@ -6,7 +6,7 @@ /* By: dkaiser mlx, wall_texture); + collectible_texture = mlx_load_png("textures/collectible.png"); + game->map.collectible_img = mlx_texture_to_image(game->mlx, collectible_texture); mlx_resize_image(wall_image, 48, 48); + mlx_resize_image(game->map.collectible_img, 48, 48); game->map.tile_size.x = 48; game->map.tile_size.y = 48; x = 0; @@ -55,6 +59,9 @@ int draw_walls(t_game *game) if (game->map.tiles[y * game->map.grid_size.x + x] == WALL) mlx_image_to_window(game->mlx, wall_image, x * game->map.tile_size.x, y * game->map.tile_size.y); + if (game->map.tiles[y * game->map.grid_size.x + x] == COLLECTIBLE) + mlx_image_to_window(game->mlx, game->map.collectible_img, x + * game->map.tile_size.x, y * game->map.tile_size.y); y++; } x++; -- cgit v1.2.3