mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
feat(player init): Set the right angle depending on the letter on the map
This commit is contained in:
parent
17768e24ae
commit
ff07c5cea1
1 changed files with 8 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue