diff --git a/.DS_Store b/.DS_Store index cb07e9a44c4772f771107127db9a9ea8dbb12980..3c9bd879cde8c2baac5bee5bafb7cc4a22e5bd30 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Escape/.DS_Store b/Escape/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d3e555cbb2fed73d757562772b225e4337064c44 Binary files /dev/null and b/Escape/.DS_Store differ diff --git a/Escape/.idea/.idea.Escape/.idea/.gitignore b/Escape/.idea/.idea.Escape/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fe9ffa56c90429c66bfc1fa34d2c24f9d5564790 --- /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 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /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 0000000000000000000000000000000000000000..5e176903c2c4547e918332537b16af259be53f93 --- /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 0000000000000000000000000000000000000000..43e39aca431ffb2fe23fa785a0633712b9e38b98 --- /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 0000000000000000000000000000000000000000..d164748ef3ffb530b112a04baa4bad2904c8c70d --- /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 0000000000000000000000000000000000000000..90a1ac6d3e99b0826e6782287150db52159ca616 --- /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