Skip to content
Snippets Groups Projects
Commit bb116107 authored by Mattila Arttu Matias's avatar Mattila Arttu Matias
Browse files

koodin siistimistä

parent ff56a8a1
No related branches found
No related tags found
No related merge requests found
...@@ -29,14 +29,10 @@ namespace Asteroid_Blaster ...@@ -29,14 +29,10 @@ namespace Asteroid_Blaster
public override void Begin() public override void Begin()
{ {
PhysicsObject alaReuna = Level.CreateBottomBorder(); AsetaPelikentta();
Level.CreateLeftBorder(0, false);
Level.CreateRightBorder(0, false);
Camera.ZoomToLevel();
Level.Background.Image = taustakuva;
_sotilas = LuoSotilas(Level.Width / 2, Level.Bottom + 75); _sotilas = LuoSotilas(Level.Width / 2, Level.Bottom + 75);
AddCollisionHandler(_sotilas, SotilasTormasi); AddCollisionHandler(_sotilas, SotilasTormasi);
AddCollisionHandler(alaReuna, AlareunaTormasi);
AsetaOhjaimet(); AsetaOhjaimet();
...@@ -85,6 +81,20 @@ namespace Asteroid_Blaster ...@@ -85,6 +81,20 @@ namespace Asteroid_Blaster
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>
/// Asettaa pelikentän alkuasetukset, kuten reunat ja taustakuvan.
/// </summary>
private void AsetaPelikentta()
{
PhysicsObject alaReuna = Level.CreateBottomBorder();
Level.CreateLeftBorder(0, false);
Level.CreateRightBorder(0, false);
Camera.ZoomToLevel();
Level.Background.Image = taustakuva;
AddCollisionHandler(alaReuna, AlareunaTormasi);
}
PhysicsObject LuoSotilas(double x, double y) PhysicsObject LuoSotilas(double x, double y)
{ {
......
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