summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDominik Kaiser2024-05-15 14:49:40 +0200
committerDominik Kaiser2024-05-15 14:49:40 +0200
commit356ccc1b6b834d502d203036feac4800b0ed3361 (patch)
tree36de507cc5e12b0086cd1d4ea3c446164fae33d3 /src
parente6edad24c9fa56538d66067dcff6bde39f746239 (diff)
downloadso_long-356ccc1b6b834d502d203036feac4800b0ed3361.tar.gz
so_long-356ccc1b6b834d502d203036feac4800b0ed3361.zip
Rename t_player to t_actor
Diffstat (limited to 'src')
-rw-r--r--src/collision.c24
-rw-r--r--src/init.c10
-rw-r--r--src/player_process.c4
3 files changed, 19 insertions, 19 deletions
diff --git a/src/collision.c b/src/collision.c
index 5c16130..4458d60 100644
--- a/src/collision.c
+++ b/src/collision.c
@@ -6,7 +6,7 @@
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/14 11:48:59 by dkaiser #+# #+# */
-/* Updated: 2024/05/15 13:20:29 by dkaiser ### ########.fr */
+/* Updated: 2024/05/15 14:47:26 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
@@ -84,24 +84,24 @@ static int check_wall_collision_with_cell(t_vector a_pos, t_ivector a_size,
return (0);
}
-void move_and_slide(t_player *player, t_tilemap *map, double delta_time)
+void move_and_slide(t_actor *actor, t_tilemap *map, double delta_time)
{
t_vector move_pos;
- move_pos.x = player->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 <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/09 14:50:09 by dkaiser #+# #+# */
-/* Updated: 2024/05/15 12:13:03 by dkaiser ### ########.fr */
+/* Updated: 2024/05/15 14:46:09 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,7 +14,7 @@
#include "so_long.h"
static void init_hooks(t_game *game);
-static void init_player(t_game *game);
+static void init_actor(t_game *game);
int init(t_game *game)
{
@@ -23,7 +23,7 @@ int init(t_game *game)
// TODO: make size and title dynamic
game->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 <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/14 12:40:05 by dkaiser #+# #+# */
-/* Updated: 2024/05/15 13:53:01 by dkaiser ### ########.fr */
+/* Updated: 2024/05/15 14:46:26 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,7 +17,7 @@ static t_vector get_direction_from_input(t_game *game);
void player_process(t_game *game)
{
- t_player *player;
+ t_actor *player;
player = &game->player;
player->direction = get_direction_from_input(game);