Skip to content
Snippets Groups Projects
Commit e88c6009 authored by Lehtinen Anni Henriikka's avatar Lehtinen Anni Henriikka
Browse files

Harjoitustyön pohja

parent b4b79cc1
No related branches found
No related tags found
No related merge requests found
No preview for this file type
File added
# 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
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
\ No newline at end of file

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
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
<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>
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment