Skip to content
Snippets Groups Projects
Commit d1b69153 authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

mailan kaantaminen

parent 8774ef4c
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,8 @@ public class AngryLego : PhysicsGame
private static readonly int tileWidth = 800 / lines[0].Length;
private static readonly int tileHeight = 480 / lines.Length;
private PhysicsObject maila; // LuoMaila, KaannaMaila
public override void Begin()
{
......@@ -58,6 +60,10 @@ public class AngryLego : PhysicsGame
Level.CreateBorders();
Camera.ZoomToLevel();
Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Show help");
Keyboard.Listen(Key.Up, ButtonState.Pressed, KaannaMailaa, "Move up", 5.0);
Keyboard.Listen(Key.Down, ButtonState.Pressed, KaannaMailaa, "Move down", -5.0);
PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
......@@ -78,6 +84,16 @@ public class AngryLego : PhysicsGame
}
/// <summary>
/// Käännetään mailaa
/// </summary>
/// <param name="kulma">millä kulmalla käännetään</param>
private void KaannaMailaa(double kulma)
{
maila.Angle += Angle.FromDegrees(kulma);
}
/// <summary>
/// Luodaan isompi yläseinäelementti
/// </summary>
......@@ -113,7 +129,7 @@ public class AngryLego : PhysicsGame
/// </summary>
private void LuoMaila(Vector paikka, double leveys, double korkeus, Color vari)
{
PhysicsObject maila = PhysicsObject.CreateStaticObject(leveys * 6, korkeus);
maila = PhysicsObject.CreateStaticObject(leveys * 6, korkeus);
maila.Position = paikka;
maila.Color = vari;
maila.Image = LoadImage("maila3");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment