From ed5342399d02ba5d1032a2ef99afdc1c875ed4d8 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Wed, 15 May 2024 12:16:05 +0200 Subject: Change collision checking and add player.size Collision checking will now be done using the move_and_slide function. Instead of tile_size, now player.size will be used for checking collisions. --- src/init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/init.c') diff --git a/src/init.c b/src/init.c index 5277b5c..9959da6 100644 --- a/src/init.c +++ b/src/init.c @@ -6,7 +6,7 @@ /* By: dkaiser player; texture = mlx_load_png("textures/player.png"); - player->position.x = game->map.player_start_tile.x * 48; - player->position.y = game->map.player_start_tile.y * 48; + player->position.x = game->map.player_start_tile.x * game->map.grid_size.x; + player->position.y = game->map.player_start_tile.y * game->map.grid_size.y; player->velocity.x = 0; player->velocity.y = 0; + player->size.x = 44; + player->size.y = 44; player->img = mlx_texture_to_image(game->mlx, texture); - mlx_resize_image(player->img, 48, 48); + mlx_resize_image(player->img, player->size.x, player->size.y); mlx_image_to_window(game->mlx, player->img, player->position.x, player->position.y); } -- cgit v1.2.3