From e88c600991a66e649dde4089e800a2e8341b310d Mon Sep 17 00:00:00 2001 From: Lehtinen Anni Henriikka <lehtineah@gmail.com> Date: Mon, 24 Mar 2025 09:05:48 +0200 Subject: [PATCH] =?UTF-8?q?Harjoitusty=C3=B6n=20pohja?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 6148 -> 6148 bytes Escape/.DS_Store | Bin 0 -> 6148 bytes Escape/.idea/.idea.Escape/.idea/.gitignore | 13 +++++ .../.idea/.idea.Escape/.idea/indexLayout.xml | 8 ++++ Escape/Escape.sln | 16 +++++++ Escape/Escape/Escape.cs | 45 ++++++++++++++++++ Escape/Escape/Escape.csproj | 13 +++++ Escape/Escape/Ohjelma.cs | 26 ++++++++++ 8 files changed, 121 insertions(+) create mode 100644 Escape/.DS_Store create mode 100644 Escape/.idea/.idea.Escape/.idea/.gitignore create mode 100644 Escape/.idea/.idea.Escape/.idea/indexLayout.xml create mode 100644 Escape/Escape.sln create mode 100644 Escape/Escape/Escape.cs create mode 100644 Escape/Escape/Escape.csproj create mode 100644 Escape/Escape/Ohjelma.cs diff --git a/.DS_Store b/.DS_Store index cb07e9a44c4772f771107127db9a9ea8dbb12980..3c9bd879cde8c2baac5bee5bafb7cc4a22e5bd30 100644 GIT binary patch delta 97 zcmZoMXfc=|&e%S&P;8=}q9_vs0|O%ig8&0V0Yhp^adJ*letyoxjp~yPL|8=G7+e{O r8Il<iQ6#&SH*R!b-^|V-z`@wQapQO9$^0U^j0~F{MGiAhY+wNZ<>(tu delta 77 zcmZoMXfc=|&e%4wP;8=}q9`K+0|O8XFfimXWHOX6q%!0%<W9V(K5>aMBjd)4X6zFm fC~aov5a3{J+j#Li^JIPzT~?5u1DkC{4l@G){TUR* diff --git a/Escape/.DS_Store b/Escape/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d3e555cbb2fed73d757562772b225e4337064c44 GIT binary patch literal 6148 zcmeHKISv9b4733uBpOP}e1RWCh<yPc;Ovk<LiAhlE}q8tC_oDx6ri!>OyYPFWs3D$ zM09@H%|s?5GJ+e*)rPLwzIn%b8Brh{XPjieJ8uu0<MGhRejPCGP#QVQR@RSv+n`Ya zDnJFO02QDDA6Fnt>}dS)lX)N&paQ?HfPEhd+^{CLf&S^h;4J`ffUq0p-b(<B1%NfN z4MYT{K?Md?v&GP$BVIDECboe=7tQ8F^JdKsMg4Z1Up!s326ChVRNz^Gek><e{~P$5 z{{NZ86&0WYf2Dv97R$vPPs-Zbd7RbS0$;%`=LR>!+$k8m90R=^V`1fZ>PeATY>xe! V*akWsai;_MGhn*VsKB=sxC6i&6<+`V literal 0 HcmV?d00001 diff --git a/Escape/.idea/.idea.Escape/.idea/.gitignore b/Escape/.idea/.idea.Escape/.idea/.gitignore new file mode 100644 index 0000000..fe9ffa5 --- /dev/null +++ b/Escape/.idea/.idea.Escape/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/.idea.Escape.iml +/modules.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Escape/.idea/.idea.Escape/.idea/indexLayout.xml b/Escape/.idea/.idea.Escape/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/Escape/.idea/.idea.Escape/.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/Escape/Escape.sln b/Escape/Escape.sln new file mode 100644 index 0000000..5e17690 --- /dev/null +++ b/Escape/Escape.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Escape", "Escape\Escape.csproj", "{8B1D90DF-F3DC-4808-ADA4-17367347EB82}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8B1D90DF-F3DC-4808-ADA4-17367347EB82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B1D90DF-F3DC-4808-ADA4-17367347EB82}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B1D90DF-F3DC-4808-ADA4-17367347EB82}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B1D90DF-F3DC-4808-ADA4-17367347EB82}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Escape/Escape/Escape.cs b/Escape/Escape/Escape.cs new file mode 100644 index 0000000..43e39ac --- /dev/null +++ b/Escape/Escape/Escape.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Jypeli; +using Jypeli.Assets; +using Jypeli.Controls; +using Jypeli.Widgets; + +namespace Escape; + +/// @author annilehtinen +/// @version 24.03.2025 +/// <summary> +/// +/// </summary> +public class Escape : PhysicsGame +{ + public override void Begin() + { + Surfaces borders = Level.CreateBorders(0.5, true, Color.White); + Camera.ZoomToLevel(); + + PhysicsObject player = new PhysicsObject(40, 40); + player.Shape = Shape.Circle; + player.Color = Color.White; + this.Add(player); + + PhysicsObject barkov = new PhysicsObject(50, 50); + barkov.Shape = Shape.Circle; + barkov.Color = Color.Red; + barkov.X = 60; + barkov.Y = -60; + this.Add(barkov); + + Keyboard.Listen(Key.Left, ButtonState.Down, MovePlayer, null, new Vector(-100, 0)); + Keyboard.Listen(Key.Right, ButtonState.Down, MovePlayer, null, new Vector(100, 0)); + Keyboard.Listen(Key.Up, ButtonState.Down, MovePlayer, null, new Vector(0, 100)); + Keyboard.Listen(Key.Down, ButtonState.Down, MovePlayer, null, new Vector(0, -100)); + + Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); + void MovePlayer(Vector vector1) + { + player.Push(vector1); + } + } +} \ No newline at end of file diff --git a/Escape/Escape/Escape.csproj b/Escape/Escape/Escape.csproj new file mode 100644 index 0000000..d164748 --- /dev/null +++ b/Escape/Escape/Escape.csproj @@ -0,0 +1,13 @@ +<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/Escape/Escape/Ohjelma.cs b/Escape/Escape/Ohjelma.cs new file mode 100644 index 0000000..90a1ac6 --- /dev/null +++ b/Escape/Escape/Ohjelma.cs @@ -0,0 +1,26 @@ +#region Using Statements + +using System; +using System.Collections.Generic; +using System.Linq; + +#endregion + +namespace Escape +{ + /// <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 Escape(); + game.Run(); + } + } +} \ No newline at end of file -- GitLab