diff --git a/KelaCombat/.idea/.idea.KelaCombat/.idea/.gitignore b/KelaCombat/.idea/.idea.KelaCombat/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..32f5b5cc4c2d1e91b3a5624c3ba16cd7875bcd8b --- /dev/null +++ b/KelaCombat/.idea/.idea.KelaCombat/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/modules.xml +/contentModel.xml +/.idea.KelaCombat.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/KelaCombat/.idea/.idea.KelaCombat/.idea/indexLayout.xml b/KelaCombat/.idea/.idea.KelaCombat/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/KelaCombat/.idea/.idea.KelaCombat/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?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/KelaCombat/.idea/.idea.KelaCombat/.idea/vcs.xml b/KelaCombat/.idea/.idea.KelaCombat/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c0b8635858dc7ad44b93df54b762707ce49eefc --- /dev/null +++ b/KelaCombat/.idea/.idea.KelaCombat/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?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/KelaCombat/KelaCombat.sln b/KelaCombat/KelaCombat.sln new file mode 100644 index 0000000000000000000000000000000000000000..1e7a7c2d88b9cc02a9c4415063e7da1c69eb46c8 --- /dev/null +++ b/KelaCombat/KelaCombat.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KelaCombat", "KelaCombat\KelaCombat.csproj", "{FCA55966-05CA-4283-A710-B896BF8F5632}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KelacombatUusi", "KelacombatUusi\KelacombatUusi.csproj", "{F19A3636-29EE-45C1-BE40-20C63E42A556}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FCA55966-05CA-4283-A710-B896BF8F5632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCA55966-05CA-4283-A710-B896BF8F5632}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCA55966-05CA-4283-A710-B896BF8F5632}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCA55966-05CA-4283-A710-B896BF8F5632}.Release|Any CPU.Build.0 = Release|Any CPU + {F19A3636-29EE-45C1-BE40-20C63E42A556}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F19A3636-29EE-45C1-BE40-20C63E42A556}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F19A3636-29EE-45C1-BE40-20C63E42A556}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F19A3636-29EE-45C1-BE40-20C63E42A556}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/KelaCombat/KelaCombatTesti/Content/Kelabotti.png b/KelaCombat/KelaCombatTesti/Content/Kelabotti.png new file mode 100644 index 0000000000000000000000000000000000000000..03f4d6eac3440cb76ddfd667a054873bc698d176 Binary files /dev/null and b/KelaCombat/KelaCombatTesti/Content/Kelabotti.png differ diff --git a/KelaCombat/KelaCombatTesti/Content/Pelaaja.png b/KelaCombat/KelaCombatTesti/Content/Pelaaja.png new file mode 100644 index 0000000000000000000000000000000000000000..c454cca1569309bd46a8741df4dddcc43dbdf693 Binary files /dev/null and b/KelaCombat/KelaCombatTesti/Content/Pelaaja.png differ diff --git a/KelaCombat/KelaCombatTesti/KelaCombatTesti.cs b/KelaCombat/KelaCombatTesti/KelaCombatTesti.cs new file mode 100644 index 0000000000000000000000000000000000000000..7979fef99a3548b6437bf1b1dafcebfc9cbc1873 --- /dev/null +++ b/KelaCombat/KelaCombatTesti/KelaCombatTesti.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using Jypeli; +using Jypeli.Assets; +using Jypeli.Controls; +using Jypeli.Widgets; +using Silk.NET.SDL; +using Color = Jypeli.Color; + +namespace KelaCombatTesti; + +/// @author Sakari +/// @version 17.02.2025 +/// <summary> +/// +/// </summary> + public class KelaCombatTesti : PhysicsGame + { + PlatformCharacter pelaaja; + private Image KelabottiKuva = LoadImage("Kelabotti"); + private Image PelaajaKuva = LoadImage("Pelaaja.png"); + + + public override void Begin() + { + LuoKentta(); + LuoKelabotti(); + + + + Keyboard.Listen(Key.A, ButtonState.Down, LiikuVasemmalle, null, new Vector()); + Keyboard.Listen(Key.D, ButtonState.Down, LiikuOikealle, null, new Vector()); + Keyboard.Listen(Key.W, ButtonState.Down, Hyppaa, null, new Vector()); + //Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000)); + Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); + + + + void LiikuVasemmalle(Vector vektori) + { + pelaaja.Walk(-100); + } + + void LiikuOikealle(Vector vektori) + { + pelaaja.Walk(100); + } + + void Hyppaa(Vector vektori) + { + pelaaja.Jump(300.0); + } + } + + void LuoKentta() + { + + Level.BackgroundColor = Color.Pink; + Gravity = new Vector(0, -981.0); + + PhysicsObject vasenReuna = Level.CreateLeftBorder(); + vasenReuna.Restitution = 0.0; + vasenReuna.KineticFriction = 0.0; + vasenReuna.IsVisible = false; + + PhysicsObject oikeaReuna = Level.CreateRightBorder(); + oikeaReuna.Restitution = 0.0; + oikeaReuna.KineticFriction = 0.0; + oikeaReuna.IsVisible = false; + + PhysicsObject ylaReuna = Level.CreateTopBorder(); + ylaReuna.Restitution = 0.0; + ylaReuna.KineticFriction = 0.0; + ylaReuna.IsVisible = false; + + PhysicsObject alaReuna = Level.CreateBottomBorder(); + alaReuna.Restitution = 1.0; + alaReuna.IsVisible = false; + alaReuna.KineticFriction = 0.0; + + pelaaja = LuoPelaaja(0.0, 0.0); + pelaaja.Acceleration = new Vector(1, 0); + + } + + PlatformCharacter LuoPelaaja(double x, double y) + { + PlatformCharacter pelaaja = new PlatformCharacter(50.0, 100.0); + pelaaja.Image = PelaajaKuva; + pelaaja.Mass = 1.0; + pelaaja.Image = LoadImage("Pelaaja.png"); + pelaaja.Shape = Shape.Rectangle; + pelaaja.Color = Color.Black; + pelaaja.X = x; + pelaaja.Y = y; + Add(pelaaja); + + + + return pelaaja; + } + + PlatformCharacter LuoKelabotti() + { + PlatformCharacter Kelabotti = new PlatformCharacter(80.0, 80.0); + Kelabotti.Color = Color.Orange; + Kelabotti.Image = KelabottiKuva; + Kelabotti.MirrorImage(); + Add(Kelabotti); + + + FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja); + seuraajanAivot.Speed = 100; + + Kelabotti.Brain = seuraajanAivot; + return Kelabotti; + + } + + + + } + + + + + diff --git a/KelaCombat/KelaCombatTesti/KelaCombatTesti.csproj b/KelaCombat/KelaCombatTesti/KelaCombatTesti.csproj new file mode 100644 index 0000000000000000000000000000000000000000..1e0a6fd54520eafb4dd06c4d897f908bc083afd6 --- /dev/null +++ b/KelaCombat/KelaCombatTesti/KelaCombatTesti.csproj @@ -0,0 +1,25 @@ +<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> + + <ItemGroup> + <None Update="KelaCombatkuvat\Pelaaja.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Update="Content\Pelaaja.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Update="Content\Kelabotti.png"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </ItemGroup> + +</Project> diff --git a/KelaCombat/KelaCombatTesti/Ohjelma.cs b/KelaCombat/KelaCombatTesti/Ohjelma.cs new file mode 100644 index 0000000000000000000000000000000000000000..7712c76c7f032bd6e75f12c3d1a84eb25da1fa38 --- /dev/null +++ b/KelaCombat/KelaCombatTesti/Ohjelma.cs @@ -0,0 +1,26 @@ +#region Using Statements + +using System; +using System.Collections.Generic; +using System.Linq; + +#endregion + +namespace KelaCombatTesti +{ + /// <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 KelaCombatTesti(); + game.Run(); + } + } +} \ No newline at end of file diff --git a/suunnitelma/suunnitelma.md b/suunnitelma/suunnitelma.md index bcfa3012dacde0189975d7b1083852f11aefb59a..9c335da731ea98d099c29d83d854aad1485388e3 100644 --- a/suunnitelma/suunnitelma.md +++ b/suunnitelma/suunnitelma.md @@ -7,7 +7,7 @@ Tekijät: Sakari Hanki ja Salla Laine Työ git-varaston osoite: <https://gitlab.jyu.fi/hankssxs/ohj1ht> -Pelin nimi: Kela Combat: Fight for Opintonopat +Pelin nimi: Kela Combat: Fight for the Opintonopat Pelialusta: Windows @@ -36,12 +36,12 @@ Helmikuu Maaliskuu -- (Tavoite 1) -- (Tavoite 2) +- (Tavoite 1: Hp mekaniikat ja Opintonoppa-laskuri) +- (Tavoite 2: taistelumekaniikat) - (Tavoite 3) Jos aikaa jää -- (Tavoite 1) -- (Tavoite 2) +- (Tavoite 1: animaatiot) +- (Tavoite 2: lisää vihollistyyppejä) - (Tavoite 3)