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

AngryLego Seina

parent 40faa869
No related branches found
No related tags found
No related merge requests found
...@@ -12,12 +12,58 @@ using System.Collections.Generic; ...@@ -12,12 +12,58 @@ using System.Collections.Generic;
/// </summary> /// </summary>
public class AngryLego : PhysicsGame public class AngryLego : PhysicsGame
{ {
private static readonly String[] lines = {
" ",
" ",
" ",
" ",
"/ ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ======= ",
" Y* Y Y ",
" X X X ",
" * X X X * ",
" X X X ",
" X *X *X ",
};
private static readonly int tileWidth = 800 / lines[0].Length;
private static readonly int tileHeight = 480 / lines.Length;
public override void Begin() public override void Begin()
{ {
// Kirjoita ohjelmakoodisi tähän Level.Background.CreateGradient(Color.Blue, Color.White);
TileMap tiles = TileMap.FromStringArray(lines);
tiles.SetTileMethod('X', LuoSeina, Color.Wheat);
tiles.Execute(tileWidth, tileHeight);
PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
} }
/// <summary>
/// Luodaan seinäelementti
/// </summary>
private void LuoSeina(Vector paikka, double leveys, double korkeus, Color vari)
{
PhysicsObject seina = new PhysicsObject(leveys, korkeus);
seina.Position = paikka;
seina.Color = vari;
seina.Tag = "rakenne";
Add(seina);
}
} }
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