int main(int argc, const char * argv[]) { Player player; PathSegment *path = GenerateAdventure(); PrintPath(path); player.current = path; player.current->direction = DirectionMain; player.health = 100; char input[300]; while (playing) { pathPrompt(&player); if(playing){ scanf("%s", input); printf("input was %s\n", input); if(strstr(input,"Y")) movePlayer(&player,DirectionMain); else movePlayer(&player,DirectionSide); printPlayerStatus(&player); } } FreeAllPathSegments(path); return 0; }
int main(int argc, const char * argv[]) { PathSegment *path = GenerateAdventure(); PrintPath(path); bool playing = true; char input[300]; int inputNumber; Player player; player.name = GetPlayerName(); Direction direction; while (playing) { PathSegment segment; player.health = 80; player.wealth = 100; player.currentPathSegment = path; printf("%s:Your health is %d\n, Your wealth is %d\n",player.name,player.health,player.wealth); printf("Please enter a direction: 0 for straight 1 for right and 2 for left\n"); scanf("%d",&direction); moveInDirection(&player, direction); printf("Your distance travelled is %d",player.distanceTraveled); if(player.health >= 100 || player.health <= 0) { printf("Game over"); break; } } FreeAllPathSegments(path); return 0; }