From 7e23a71d2a3df7c8e6b63f569d658064f48717d0 Mon Sep 17 00:00:00 2001 From: Limma Sakari Antti <sakari.a.limma@student.jyu.fi> Date: Thu, 3 Apr 2025 12:38:57 +0300 Subject: [PATCH] =?UTF-8?q?viimestely=C3=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App1/.idea/.idea.App1/.idea/.gitignore | 13 --- App1/.idea/.idea.App1/.idea/encodings.xml | 4 - App1/.idea/.idea.App1/.idea/indexLayout.xml | 8 -- App1/.idea/.idea.App1/.idea/vcs.xml | 6 -- App1/App1.sln | 16 --- App1/App1/App1.cs | 69 ------------ App1/App1/App1.csproj | 9 -- App2/App2.sln | 16 --- App2/App2/App2.cs | 25 ----- App2/App2/App2.csproj | 12 --- App2/App2/Ohjelma.cs | 24 ----- App3/.idea/.idea.App3/.idea/.gitignore | 13 --- App3/.idea/.idea.App3/.idea/encodings.xml | 4 - App3/.idea/.idea.App3/.idea/indexLayout.xml | 8 -- App3/.idea/.idea.App3/.idea/vcs.xml | 6 -- App3/App3.sln | 16 --- App3/App3/App3.cs | 99 ------------------ App3/App3/App3.csproj | 13 --- App3/App3/Ohjelma.cs | 26 ----- .../.idea/.idea.Arvaaluku/.idea/.gitignore | 13 --- .../.idea/.idea.Arvaaluku/.idea/encodings.xml | 4 - .../.idea.Arvaaluku/.idea/indexLayout.xml | 8 -- Arvaaluku/.idea/.idea.Arvaaluku/.idea/vcs.xml | 6 -- Arvaaluku/Arvaaluku.sln | 16 --- .../.idea.Arvaaluku.dir/.idea/.gitignore | 13 --- .../.idea.Arvaaluku.dir/.idea/indexLayout.xml | 8 -- .../.idea/.idea.Arvaaluku.dir/.idea/vcs.xml | 6 -- Arvaaluku/Arvaaluku/Arvaaluku.csproj | 28 ----- Arvaaluku/Arvaaluku/Ohjelma.cs | 26 ----- .../Arvaaluku/Content => Content}/DEMOni.png | Bin .../Arvaaluku/Content => Content}/DEMOni2.png | Bin Content/arvaa.cs | 93 ++++++++++++++++ .../Content => Content}/puhekupla.png | Bin DemoniEscape/DemoniEscape/DemoniEscape.cs | 18 ++-- 34 files changed, 103 insertions(+), 523 deletions(-) delete mode 100644 App1/.idea/.idea.App1/.idea/.gitignore delete mode 100644 App1/.idea/.idea.App1/.idea/encodings.xml delete mode 100644 App1/.idea/.idea.App1/.idea/indexLayout.xml delete mode 100644 App1/.idea/.idea.App1/.idea/vcs.xml delete mode 100644 App1/App1.sln delete mode 100644 App1/App1/App1.cs delete mode 100644 App1/App1/App1.csproj delete mode 100644 App2/App2.sln delete mode 100644 App2/App2/App2.cs delete mode 100644 App2/App2/App2.csproj delete mode 100644 App2/App2/Ohjelma.cs delete mode 100644 App3/.idea/.idea.App3/.idea/.gitignore delete mode 100644 App3/.idea/.idea.App3/.idea/encodings.xml delete mode 100644 App3/.idea/.idea.App3/.idea/indexLayout.xml delete mode 100644 App3/.idea/.idea.App3/.idea/vcs.xml delete mode 100644 App3/App3.sln delete mode 100644 App3/App3/App3.cs delete mode 100644 App3/App3/App3.csproj delete mode 100644 App3/App3/Ohjelma.cs delete mode 100644 Arvaaluku/.idea/.idea.Arvaaluku/.idea/.gitignore delete mode 100644 Arvaaluku/.idea/.idea.Arvaaluku/.idea/encodings.xml delete mode 100644 Arvaaluku/.idea/.idea.Arvaaluku/.idea/indexLayout.xml delete mode 100644 Arvaaluku/.idea/.idea.Arvaaluku/.idea/vcs.xml delete mode 100644 Arvaaluku/Arvaaluku.sln delete mode 100644 Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/.gitignore delete mode 100644 Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/indexLayout.xml delete mode 100644 Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/vcs.xml delete mode 100644 Arvaaluku/Arvaaluku/Arvaaluku.csproj delete mode 100644 Arvaaluku/Arvaaluku/Ohjelma.cs rename {Arvaaluku/Arvaaluku/Content => Content}/DEMOni.png (100%) rename {Arvaaluku/Arvaaluku/Content => Content}/DEMOni2.png (100%) create mode 100644 Content/arvaa.cs rename {Arvaaluku/Arvaaluku/Content => Content}/puhekupla.png (100%) diff --git a/App1/.idea/.idea.App1/.idea/.gitignore b/App1/.idea/.idea.App1/.idea/.gitignore deleted file mode 100644 index 5f40688..0000000 --- a/App1/.idea/.idea.App1/.idea/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Rider ignored files -/.idea.App1.iml -/projectSettingsUpdater.xml -/contentModel.xml -/modules.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/App1/.idea/.idea.App1/.idea/encodings.xml b/App1/.idea/.idea.App1/.idea/encodings.xml deleted file mode 100644 index df87cf9..0000000 --- a/App1/.idea/.idea.App1/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> -</project> \ No newline at end of file diff --git a/App1/.idea/.idea.App1/.idea/indexLayout.xml b/App1/.idea/.idea.App1/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/App1/.idea/.idea.App1/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="UserContentModel"> - <attachedFolders /> - <explicitIncludes /> - <explicitExcludes /> - </component> -</project> \ No newline at end of file diff --git a/App1/.idea/.idea.App1/.idea/vcs.xml b/App1/.idea/.idea.App1/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/App1/.idea/.idea.App1/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/App1/App1.sln b/App1/App1.sln deleted file mode 100644 index 0cda08f..0000000 --- a/App1/App1.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App1", "App1\App1.csproj", "{9C15D0BE-45A8-422B-93E3-2BBBFFA7E1F5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9C15D0BE-45A8-422B-93E3-2BBBFFA7E1F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9C15D0BE-45A8-422B-93E3-2BBBFFA7E1F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9C15D0BE-45A8-422B-93E3-2BBBFFA7E1F5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9C15D0BE-45A8-422B-93E3-2BBBFFA7E1F5}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/App1/App1/App1.cs b/App1/App1/App1.cs deleted file mode 100644 index 592ef4a..0000000 --- a/App1/App1/App1.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Text; -using System.Linq; -using System.Collections.Generic; - -/// @author sakar -/// @version 04.03.2025 -/// <summary> -/// -/// </summary> -public class App1 -{ - /// <summary> - /// - /// </summary> -static void Main(string[] args) - { - Random random = new Random(); - int targetNumber = random.Next(1, 101); - int attempts = 5; - bool guessed = false; - - Console.WriteLine("Tervetuloa DEMOn Escape -peliin!"); - Console.WriteLine("Pelin idea: Arvaa luku väliltä 1-100."); - Console.WriteLine($"Sinulla on {attempts} yritystä."); - - while (attempts > 0 && !guessed) - { - Console.Write("Arvauksesi: "); - string input = Console.ReadLine(); - int guess; - - if (int.TryParse(input, out guess)) - { - if (guess == targetNumber) - { - Console.WriteLine("Onnittelut! Arvasit oikein ja pääsit pakoon DEMOn kynsistä!"); - guessed = true; - } - else if (guess < targetNumber) - { - Console.WriteLine("DEMOn kuiskaus: Luku on suurempi..."); - } - else - { - Console.WriteLine("DEMOn kuiskaus: Luku on pienempi..."); - } - - attempts--; - if (attempts > 0 && !guessed) - { - Console.WriteLine($"Yrityksiä jäljellä: {attempts}"); - } - } - else - { - Console.WriteLine("Syötä kelvollinen numero!"); - } - } - - if (!guessed) - { - Console.WriteLine($"Hävisit! Oikea luku oli {targetNumber}. DEMOn vangiksi jäit..."); - } - - Console.WriteLine("Paina Enter lopettaaksesi..."); - Console.ReadLine(); - } -} diff --git a/App1/App1/App1.csproj b/App1/App1/App1.csproj deleted file mode 100644 index 085a6e3..0000000 --- a/App1/App1/App1.csproj +++ /dev/null @@ -1,9 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>Exe</OutputType> - <TargetFramework>net8.0</TargetFramework> - <ExternalConsole>true</ExternalConsole> - </PropertyGroup> - -</Project> diff --git a/App2/App2.sln b/App2/App2.sln deleted file mode 100644 index a5c2145..0000000 --- a/App2/App2.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App2", "App2\App2.csproj", "{A88BF983-4078-4A1F-9BC1-EFA39E2104C9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A88BF983-4078-4A1F-9BC1-EFA39E2104C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A88BF983-4078-4A1F-9BC1-EFA39E2104C9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A88BF983-4078-4A1F-9BC1-EFA39E2104C9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A88BF983-4078-4A1F-9BC1-EFA39E2104C9}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/App2/App2/App2.cs b/App2/App2/App2.cs deleted file mode 100644 index 88d37bb..0000000 --- a/App2/App2/App2.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using Jypeli; -using Jypeli.Assets; -using Jypeli.Controls; -using Jypeli.Widgets; - -namespace App2; - -/// @author sakar -/// @version 04.03.2025 -/// <summary> -/// -/// </summary> -public class App2 : Game -{ - public override void Begin() - { - // Kirjoita ohjelmakoodisi tähän - - PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); - Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); - } -} - diff --git a/App2/App2/App2.csproj b/App2/App2/App2.csproj deleted file mode 100644 index 6617984..0000000 --- a/App2/App2/App2.csproj +++ /dev/null @@ -1,12 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>WinExe</OutputType> - <TargetFramework>net8.0</TargetFramework> - </PropertyGroup> - - <ItemGroup> - <PackageReference Include="Jypeli.NET" Version="11.*"/> - </ItemGroup> - -</Project> diff --git a/App2/App2/Ohjelma.cs b/App2/App2/Ohjelma.cs deleted file mode 100644 index b8bf010..0000000 --- a/App2/App2/Ohjelma.cs +++ /dev/null @@ -1,24 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -#endregion - -namespace App2 -{ - /// <summary> - /// The main class. - /// </summary> - public static class Program - { - /// <summary> - /// The main entry point for the application. - /// </summary> - [STAThread] - static void Main() - { - using var game = new App2(); - game.Run(); - } - } -} diff --git a/App3/.idea/.idea.App3/.idea/.gitignore b/App3/.idea/.idea.App3/.idea/.gitignore deleted file mode 100644 index 6cd527b..0000000 --- a/App3/.idea/.idea.App3/.idea/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Rider ignored files -/contentModel.xml -/projectSettingsUpdater.xml -/modules.xml -/.idea.App3.iml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/App3/.idea/.idea.App3/.idea/encodings.xml b/App3/.idea/.idea.App3/.idea/encodings.xml deleted file mode 100644 index df87cf9..0000000 --- a/App3/.idea/.idea.App3/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> -</project> \ No newline at end of file diff --git a/App3/.idea/.idea.App3/.idea/indexLayout.xml b/App3/.idea/.idea.App3/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/App3/.idea/.idea.App3/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="UserContentModel"> - <attachedFolders /> - <explicitIncludes /> - <explicitExcludes /> - </component> -</project> \ No newline at end of file diff --git a/App3/.idea/.idea.App3/.idea/vcs.xml b/App3/.idea/.idea.App3/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/App3/.idea/.idea.App3/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/App3/App3.sln b/App3/App3.sln deleted file mode 100644 index 9e48b2f..0000000 --- a/App3/App3.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App3", "App3\App3.csproj", "{53DAF4CF-D0A6-4931-A5B9-5A1ABF38B857}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {53DAF4CF-D0A6-4931-A5B9-5A1ABF38B857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {53DAF4CF-D0A6-4931-A5B9-5A1ABF38B857}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53DAF4CF-D0A6-4931-A5B9-5A1ABF38B857}.Release|Any CPU.ActiveCfg = Release|Any CPU - {53DAF4CF-D0A6-4931-A5B9-5A1ABF38B857}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/App3/App3/App3.cs b/App3/App3/App3.cs deleted file mode 100644 index deb5028..0000000 --- a/App3/App3/App3.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using Jypeli; -using Jypeli.Assets; -using Jypeli.Controls; -using Jypeli.Widgets; - -namespace App3; - -/// @author sakar -/// @version 04.03.2025 -/// <summary> -/// -/// </summary> -using System; -using Jypeli; - -public class App3 : PhysicsGame -{ - private int targetNumber; - private int attempts; - private Label infoLabel; - private IntMeter guessMeter; - - public override void Begin() - { - Level.Background.Color = Color.White; - StartGame(); - } - - private void StartGame() - { - targetNumber = RandomGen.NextInt(1, 101); - attempts = 5; - - ClearAll(); - - infoLabel = new Label(); - infoLabel.Text = "Tervetuloa DEMOn Escape -peliin!\nArvaa luku väliltä 1-100.\nSinulla on 5 yritystä."; - infoLabel.Position = new Vector(0, Screen.Top - 50); - infoLabel.Font = Font.DefaultBold; - Add(infoLabel); - - guessMeter = new IntMeter(1, 1, 100); - Label guessLabel = new Label(); - guessLabel.BindTo(guessMeter); - guessLabel.Position = new Vector(0, 0); - guessLabel.Font = Font.DefaultBold; - Add(guessLabel); - - Keyboard.Listen(Key.Enter, ButtonState.Pressed, CheckGuess, "Tarkista arvaus"); - Keyboard.Listen(Key.Up, ButtonState.Down, () => { if (guessMeter.Value < 100) guessMeter.Value++; }, "Lisää arvausta"); - Keyboard.Listen(Key.Down, ButtonState.Down, () => { if (guessMeter.Value > 1) guessMeter.Value--; }, "Vähennä arvausta"); - Keyboard.Listen(Key.R, ButtonState.Pressed, StartGame, "Pelaa uudelleen"); - Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Lopeta peli"); - - MessageDisplay.Add("Peli alkaa! Paina Enter arvauksen vahvistamiseksi."); - } - - private void CheckGuess() - { - if (attempts > 0) - { - int guess = guessMeter.Value; - if (guess == targetNumber) - { - infoLabel.Text = "Onnittelut! Arvasit oikein ja pääsit pakoon DEMOn kynsistä!\nPaina R pelataksesi uudelleen."; - MessageDisplay.Add("Voitit pelin!"); - return; - } - else if (guess < targetNumber) - { - infoLabel.Text = "DEMOn kuiskaus: Luku on suurempi..."; - } - else - { - infoLabel.Text = "DEMOn kuiskaus: Luku on pienempi..."; - } - attempts--; - MessageDisplay.Add($"Yrityksiä jäljellä: {attempts}"); - } - if (attempts == 0) - { - infoLabel.Text = $"Hävisit! Oikea luku oli {targetNumber}. DEMOn vangiksi jäit...\nPaina R pelataksesi uudelleen."; - MessageDisplay.Add("Peli päättyi."); - } - } - - public static void PelaaUudelleen() - { - new App3().Run(); - } -} - - - - - - diff --git a/App3/App3/App3.csproj b/App3/App3/App3.csproj deleted file mode 100644 index d164748..0000000 --- a/App3/App3/App3.csproj +++ /dev/null @@ -1,13 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>WinExe</OutputType> - <TargetFramework>net8.0</TargetFramework> - </PropertyGroup> - - <ItemGroup> - <PackageReference Include="Jypeli.NET" Version="11.*"/> - <PackageReference Include="Jypeli.FarseerPhysics.NET" Version="2.*"/> - </ItemGroup> - -</Project> diff --git a/App3/App3/Ohjelma.cs b/App3/App3/Ohjelma.cs deleted file mode 100644 index 6e9d182..0000000 --- a/App3/App3/Ohjelma.cs +++ /dev/null @@ -1,26 +0,0 @@ -#region Using Statements - -using System; -using System.Collections.Generic; -using System.Linq; - -#endregion - -namespace App3 -{ - /// <summary> - /// The main class. - /// </summary> - public static class Program - { - /// <summary> - /// The main entry point for the application. - /// </summary> - [STAThread] - static void Main() - { - using var game = new App3(); - game.Run(); - } - } -} \ No newline at end of file diff --git a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/.gitignore b/Arvaaluku/.idea/.idea.Arvaaluku/.idea/.gitignore deleted file mode 100644 index d6110b7..0000000 --- a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Rider ignored files -/modules.xml -/contentModel.xml -/.idea.Arvaaluku.iml -/projectSettingsUpdater.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/encodings.xml b/Arvaaluku/.idea/.idea.Arvaaluku/.idea/encodings.xml deleted file mode 100644 index df87cf9..0000000 --- a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> -</project> \ No newline at end of file diff --git a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/indexLayout.xml b/Arvaaluku/.idea/.idea.Arvaaluku/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="UserContentModel"> - <attachedFolders /> - <explicitIncludes /> - <explicitExcludes /> - </component> -</project> \ No newline at end of file diff --git a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/vcs.xml b/Arvaaluku/.idea/.idea.Arvaaluku/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/Arvaaluku/.idea/.idea.Arvaaluku/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/Arvaaluku/Arvaaluku.sln b/Arvaaluku/Arvaaluku.sln deleted file mode 100644 index 7ff532a..0000000 --- a/Arvaaluku/Arvaaluku.sln +++ /dev/null @@ -1,16 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arvaaluku", "Arvaaluku\Arvaaluku.csproj", "{CF82A902-DDD3-4550-AFB6-3C2E51D47ECA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CF82A902-DDD3-4550-AFB6-3C2E51D47ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF82A902-DDD3-4550-AFB6-3C2E51D47ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF82A902-DDD3-4550-AFB6-3C2E51D47ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF82A902-DDD3-4550-AFB6-3C2E51D47ECA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/.gitignore b/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/.gitignore deleted file mode 100644 index 43eccc9..0000000 --- a/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Rider ignored files -/contentModel.xml -/projectSettingsUpdater.xml -/modules.xml -/.idea.Arvaaluku.iml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/indexLayout.xml b/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="UserContentModel"> - <attachedFolders /> - <explicitIncludes /> - <explicitExcludes /> - </component> -</project> \ No newline at end of file diff --git a/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/vcs.xml b/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/vcs.xml deleted file mode 100644 index b2bdec2..0000000 --- a/Arvaaluku/Arvaaluku/.idea/.idea.Arvaaluku.dir/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/Arvaaluku/Arvaaluku/Arvaaluku.csproj b/Arvaaluku/Arvaaluku/Arvaaluku.csproj deleted file mode 100644 index 677799e..0000000 --- a/Arvaaluku/Arvaaluku/Arvaaluku.csproj +++ /dev/null @@ -1,28 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>WinExe</OutputType> - <TargetFramework>net8.0</TargetFramework> - </PropertyGroup> - - <ItemGroup> - <PackageReference Include="Jypeli.NET" Version="11.*"/> - </ItemGroup> - - <ItemGroup> - <Folder Include="Content\" /> - </ItemGroup> - - <ItemGroup> - <None Update="Content\DEMOni.png"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Update="Content\DEMOni2.png"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Update="Content\puhekupla.png"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - </ItemGroup> - -</Project> diff --git a/Arvaaluku/Arvaaluku/Ohjelma.cs b/Arvaaluku/Arvaaluku/Ohjelma.cs deleted file mode 100644 index d11ccef..0000000 --- a/Arvaaluku/Arvaaluku/Ohjelma.cs +++ /dev/null @@ -1,26 +0,0 @@ -#region Using Statements - -using System; -using System.Collections.Generic; -using System.Linq; - -#endregion - -namespace Arvaaluku -{ - /// <summary> - /// The main class. - /// </summary> - public static class Program - { - /// <summary> - /// The main entry point for the application. - /// </summary> - [STAThread] - static void Main() - { - using var game = new Arvaaluku(); - game.Run(); - } - } -} \ No newline at end of file diff --git a/Arvaaluku/Arvaaluku/Content/DEMOni.png b/Content/DEMOni.png similarity index 100% rename from Arvaaluku/Arvaaluku/Content/DEMOni.png rename to Content/DEMOni.png diff --git a/Arvaaluku/Arvaaluku/Content/DEMOni2.png b/Content/DEMOni2.png similarity index 100% rename from Arvaaluku/Arvaaluku/Content/DEMOni2.png rename to Content/DEMOni2.png diff --git a/Content/arvaa.cs b/Content/arvaa.cs new file mode 100644 index 0000000..689c985 --- /dev/null +++ b/Content/arvaa.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using Jypeli; +using Jypeli.Assets; +using Jypeli.Controls; +using Jypeli.Widgets; +using Microsoft.Win32.SafeHandles; + +namespace Arvaa; + +/// @author sakar +/// @version 04.03.2025 +/// <summary> +/// +/// </summary> +using System; +using Jypeli; +using Jypeli.Controls; +using Jypeli.Widgets; + + +public class Arvaa : Game +{ + int arvattava; + int yritykset = 10; + Label viesti; + Label viesti2; + Label viesti3; + InputBox syotekentta; + + public override void Begin() + { + arvattava = RandomGen.NextInt(1, 51); + viesti = new Label("Arvaa luku 1-50") + { TextColor = Color.Black, Position = new Vector(100, 180), Font = Font.DefaultBold }; + viesti2 = new Label("Arvaa oikea luku tai jäät ikuisesti Ohjelmointi1 kurssin vangiksi!") + { TextColor = Color.Black, Position = new Vector(100, 230), Font = Font.DefaultBold }; + viesti3 = new Label(" Sinulla on 10 yritystä!") + { TextColor = Color.Black, Position = new Vector(100, 205), Font = Font.DefaultBold }; + Add(viesti); + Add(viesti2); + Add(viesti3); + + GameObject demoni = new GameObject(350, 500); + demoni.Position = new Vector(-350, -150); + demoni.Image = LoadImage("DEMOni2"); + Add(demoni); + + GameObject puhekupla = new GameObject(750, 180); + puhekupla.Position = new Vector(100, 200); + puhekupla.Image = LoadImage("puhekupla"); + Add(puhekupla); + + + syotekentta = new InputBox(10) { Position = new Vector(0, 0), TextColor = Color.Black }; + syotekentta.Color = Color.White; + Add(syotekentta); + + PushButton arvausNappi = new PushButton(150, 100, "Arvaa") { Position = new Vector(0, -100) }; + arvausNappi.Clicked += Tarkista; + Add(arvausNappi); + + Level.Background.Color = Color.Red; + Camera.ZoomToLevel(); + + } + + void Tarkista() + { + int arvaus = 0; + + if (arvaus == arvattava) + { + viesti.Text = "Oikein! Päästän sinut läpi Ohjelmointi1 kurssista!"; + viesti.TextColor = Color.Green; + viesti.Font = Font.DefaultBold; + return; + } + + yritykset--; + if (yritykset == 0) + { + viesti.Text = "Hävisit! Jäät ikuisesti vangiksi kurssille! Oikea luku olisi ollut " + arvattava; + viesti.TextColor = Color.Red; + viesti.Font = Font.DefaultBold; + return; + } + viesti.Text = (arvaus < arvattava) ? "Liian pieni!" : "Liian suuri!"; + viesti.TextColor = Color.Black; + viesti.Font = Font.DefaultBold; + } + +} diff --git a/Arvaaluku/Arvaaluku/Content/puhekupla.png b/Content/puhekupla.png similarity index 100% rename from Arvaaluku/Arvaaluku/Content/puhekupla.png rename to Content/puhekupla.png diff --git a/DemoniEscape/DemoniEscape/DemoniEscape.cs b/DemoniEscape/DemoniEscape/DemoniEscape.cs index f22de05..4ef99d7 100644 --- a/DemoniEscape/DemoniEscape/DemoniEscape.cs +++ b/DemoniEscape/DemoniEscape/DemoniEscape.cs @@ -11,13 +11,15 @@ namespace DemoniEscape /// @version 2.4.2025 /// ///<summary> - /// Arvaa luku -peli, jossa pelaaja yrittää arvata satunnaisen luvun tietyllä määrällä yrityksiä + /// Arvaa luku -peli, jossa pelaaja yrittää arvata satunnaisen luvun tietyllä määrällä yrityksiä. Pelaaja + /// on jäänyt DEMOnin vangiksi. Arvaamalla oikein hän vapautuu ja läpäisee kurssin, vastaamalla väärin + /// hän jää ikuisesti Ohjelmointi 1 kurssille. /// </summary> public class DemoniEscape : Game { /// <summary> /// Pelin asetukset - /// </summary> + /// <summary> private const int MinLuku = 1; private const int MaxLuku = 50; private const int MaxYritykset = 10; @@ -58,20 +60,20 @@ namespace DemoniEscape private void LuoKayttoliittyma() { // Viestit pelaajalle - _viesti = new Label($"Arvaa luku {MinLuku}-{MaxLuku}") + _viesti = new Label($"Arvaa luku väliltä {MinLuku}-{MaxLuku}") { TextColor = Color.Black, Position = new Vector(100, 180), Font = Font.DefaultBold }; - _viesti2 = new Label("Arvaa oikea luku tai jäät ikuisesti Ohjelmointi1 kurssin vangiksi!") + _viesti2 = new Label("Arvaa oikea luku tai jäät ikuisesti Ohjelmointi 1 kurssin vangiksi!") { TextColor = Color.Black, Position = new Vector(100, 230), Font = Font.DefaultBold }; _viesti3 = new Label($"Sinulla on {MaxYritykset} yritystä!") { TextColor = Color.Black, Position = new Vector(100, 205), Font = Font.DefaultBold }; - // Lisää käyttöliittymäelementit peliin + // Lisää viestit peliin Add(_viesti); Add(_viesti2); Add(_viesti3); // Demoni- ja puhekupla - GameObject demoni = new GameObject(350, 500) { Position = new Vector(-350, -150), Image = DemoniKuva }; + GameObject demoni = new GameObject(350, 400) { Position = new Vector(-350, -70), Image = DemoniKuva }; Add(demoni); GameObject puhekupla = new GameObject(750, 180) { Position = new Vector(100, 200), Image = PuhekuplaKuva }; @@ -110,7 +112,7 @@ namespace DemoniEscape if (arvaus == _arvattava) { _viesti.Text = "Oikein! Päästän sinut läpi Ohjelmointi1 kurssista!"; - _viesti.TextColor = Color.Green; + _viesti.TextColor = Color.Black; _viesti.Font = Font.DefaultBold; return; } @@ -119,7 +121,7 @@ namespace DemoniEscape _yritykset--; if (_yritykset == 0) { - _viesti.Text = $"Hävisit! Oikea luku olisi ollut {_arvattava}. Jäät ikuisesti vangiksi!"; + _viesti.Text = $"Hävisit! Oikea luku olisi ollut {_arvattava}. Jäät ikuisesti vangikseni!"; _viesti.TextColor = Color.Red; _viesti.Font = Font.DefaultBold; return; -- GitLab