From 356ccc1b6b834d502d203036feac4800b0ed3361 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Wed, 15 May 2024 14:49:40 +0200 Subject: [PATCH] Rename t_player to t_actor --- include/so_long.h | 10 +++++----- src/collision.c | 24 ++++++++++++------------ src/init.c | 10 +++++----- src/player_process.c | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/so_long.h b/include/so_long.h index 48c34aa..4118166 100644 --- a/include/so_long.h +++ b/include/so_long.h @@ -6,7 +6,7 @@ /* By: dkaiser position.x + (player->velocity.x * delta_time); - move_pos.y = player->position.y; + move_pos.x = actor->position.x + (actor->velocity.x * delta_time); + move_pos.y = actor->position.y; - if ((check_wall_collision(move_pos, player->size, map) & (RIGHT | LEFT)) == 0) - player->position.x = move_pos.x; + if ((check_wall_collision(move_pos, actor->size, map) & (RIGHT | LEFT)) == 0) + actor->position.x = move_pos.x; else - player->velocity.x = 0; + actor->velocity.x = 0; - move_pos.x = player->position.x; - move_pos.y = player->position.y + (player->velocity.y * delta_time); - if ((check_wall_collision(move_pos, player->size, map) & (UP | DOWN)) == 0) - player->position.y = move_pos.y; + move_pos.x = actor->position.x; + move_pos.y = actor->position.y + (actor->velocity.y * delta_time); + if ((check_wall_collision(move_pos, actor->size, map) & (UP | DOWN)) == 0) + actor->position.y = move_pos.y; else - player->velocity.y = 0; + actor->velocity.y = 0; } int is_on_floor(t_vector pos, t_ivector size, t_tilemap *map) diff --git a/src/init.c b/src/init.c index 9959da6..9926826 100644 --- a/src/init.c +++ b/src/init.c @@ -6,7 +6,7 @@ /* By: dkaiser input_direction = ZERO; init_hooks(game); - init_player(game); + init_actor(game); return (0); } @@ -33,10 +33,10 @@ static void init_hooks(t_game *game) mlx_key_hook(game->mlx, on_key_input, game); } -static void init_player(t_game *game) +static void init_actor(t_game *game) { mlx_texture_t *texture; - t_player *player; + t_actor *player; player = &game->player; texture = mlx_load_png("textures/player.png"); diff --git a/src/player_process.c b/src/player_process.c index 7e27530..c66d13d 100644 --- a/src/player_process.c +++ b/src/player_process.c @@ -6,7 +6,7 @@ /* By: dkaiser player; player->direction = get_direction_from_input(game); -- 2.47.2