diff --git a/Emne 3/ClickerOOP/ClickerOOP/Program.cs b/Emne 3/ClickerOOP/ClickerOOP/Program.cs index e5dff12..4c771a0 100644 --- a/Emne 3/ClickerOOP/ClickerOOP/Program.cs +++ b/Emne 3/ClickerOOP/ClickerOOP/Program.cs @@ -1,3 +1,28 @@ -// See https://aka.ms/new-console-template for more information +int points = 0; +int pointsPerClick = 1; +int pointsPerClickIncrease = 1; -Console.WriteLine("Hello, World!"); \ No newline at end of file +while (true) +{ + Console.Clear(); + Console.WriteLine("Kommandoer:\r\n" + + "- SPACE = klikk (og få poeng)\r\n" + + "- K = kjøp oppgradering \r\nØker poeng per klikk koster 10 poeng\r\n" + + "- S = kjøp superoppgradering øker \"poeng per klikk\" for den vanlige oppgraderingen. koster 100 poeng\r\n" + + "- X = avslutt applikasjonen"); + Console.WriteLine($"Du har {points} poeng."); + Console.WriteLine("Trykk tast for ønsket kommando."); + var command = Console.ReadKey().KeyChar; + if (command == 'x') Environment.Exit(0); + else if (command == ' ') points += pointsPerClick; + else if (command == 'k' && points >= 10) + { + points -= 10; + pointsPerClick += pointsPerClickIncrease; + } + else if (command == 's' && points >= 100) + { + points -= 100; + pointsPerClickIncrease++; + } +} \ No newline at end of file