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

Nappaimistoohjaus

parent 41e0ede9
No related branches found
No related tags found
No related merge requests found
using System;
using System.Collections.Generic;
using Jypeli;
using Jypeli.Assets;
using Jypeli.Controls;
......@@ -17,6 +15,8 @@ public class KolmionMetsastys : PhysicsGame
public override void Begin()
{
Level.Background.Color = Color.Black;
Level.CreateBorders();
BoundingRectangle alaosa = new BoundingRectangle(new Vector(Level.Left, 0), Level.BoundingRect.BottomRight);
BoundingRectangle ylaosa = new BoundingRectangle(Level.BoundingRect.TopLeft, new Vector(Level.Right, 0));
......@@ -28,11 +28,28 @@ public class KolmionMetsastys : PhysicsGame
PhysicsObject pelaaja = LuoSattunnainenKolmio(this, ylaosa, 50);
pelaaja.Color = Color.Red;
Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä avustus");
Keyboard.Listen(Key.Up, ButtonState.Pressed, LyoKolmiota, "Pelaaja ylös", pelaaja, new Vector(0, 200));
Keyboard.Listen(Key.Down, ButtonState.Pressed, LyoKolmiota, "Pelaaja alas", pelaaja, new Vector(0, -200));
Keyboard.Listen(Key.Left, ButtonState.Pressed, LyoKolmiota, "Pelaaja vasemmalle", pelaaja, new Vector(-200, 0));
Keyboard.Listen(Key.Right, ButtonState.Pressed, LyoKolmiota, "Pelaaja oikealle", pelaaja, new Vector(200, 0));
PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
}
/// <summary>
/// Lyödään kolmiota voimavektorilla
/// </summary>
/// <param name="kolmio">lyötävä kolmio</param>
/// <param name="suunta">voimavektori</param>
public static void LyoKolmiota(PhysicsObject kolmio, Vector suunta)
{
kolmio.Hit(suunta);
}
/// <summary>
/// Luodaan satunnainen kolmio suorakaiteen sisälle. Myös väri ja kulma arvotaan.
/// </summary>
......
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