From ff07c5cea1960419ff9ce450df5921510e4528d2 Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Mon, 28 Jul 2025 11:12:24 +0200 Subject: [PATCH] feat(player init): Set the right angle depending on the letter on the map --- src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 42934ca..422b8b1 100644 --- a/src/main.c +++ b/src/main.c @@ -29,7 +29,14 @@ void init_player(t_mapdata *mapdata, t_player *player) player->health = 100; player->x = mapdata->startx; player->y = mapdata->starty; - player->yaw = M_PI; + if (mapdata->map[mapdata->starty][mapdata->startx] == 'N') + player->yaw = M_PI; + else if (mapdata->map[mapdata->starty][mapdata->startx] == 'S') + player->yaw = 0; + else if (mapdata->map[mapdata->starty][mapdata->startx] == 'E') + player->yaw = M_PI / 2; + else if (mapdata->map[mapdata->starty][mapdata->startx] == 'W') + player->yaw = 3 * M_PI / 2; } int game_loop(t_cub3d_data *data)