feat(player init): Set the right angle depending on the letter on the map

This commit is contained in:
Theo Champion 2025-07-28 11:12:24 +02:00 committed by Khaïs COLIN
parent 17768e24ae
commit ff07c5cea1

View file

@ -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)