/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* player.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tchampio dir_x = 0; player->dir_y = -1; player->plane_x = PLANE_VALUE; player->plane_y = 0; } else { player->dir_x = 0; player->dir_y = 1; player->plane_x = -PLANE_VALUE; player->plane_y = 0; } } // north south void init_lat(t_player *player, char dir) { if (dir == 'E') { player->dir_x = 1; player->dir_y = 0; player->plane_x = 0; player->plane_y = PLANE_VALUE; } else { player->dir_x = -1; player->dir_y = 0; player->plane_x = 0; player->plane_y = -PLANE_VALUE; } } void init_player(t_player *player, t_mapdata *map) { char dir; dir = map->map[map->starty][map->startx]; player->x = map->startx + 0.5; player->y = map->starty + 0.5; map->map[map->starty][map->startx] = '0'; player->health = 100; player->points = 500; if (dir == 'N' || dir == 'S') init_lon(player, dir); else init_lat(player, dir); }