Skip to content
Snippets Groups Projects
Commit f63eaac6 authored by Saksi Kerttu's avatar Saksi Kerttu
Browse files

lisättiin kenttä peliin

parent d3e44e1d
No related branches found
No related tags found
No related merge requests found
......@@ -57,10 +57,15 @@ namespace Sammakkopeli
public void AlustaKentta()
{
Level.BackgroundColor = Color.Black;
LuoPelihahmo(0, 0);
Level.BackgroundColor = Color.Aqua;
Level.CreateBottomBorder(0.0, true);
ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Kentta1");
ruudut.SetTileMethod(Color.Gold, LuoTaso);
ruudut.SetTileMethod(Color.Red, LuoPelihahmo);
ruudut.SetTileMethod(Color.Orange, LuoHilleri);
ruudut.SetTileMethod(Color.Black, LuoKarpanen);
ruudut.Execute(20, 20);
Camera.Follow(sammakko);
......@@ -75,13 +80,11 @@ namespace Sammakkopeli
}
public void LuoPelihahmo(double x, double y)
public void LuoPelihahmo(Vector paikka, double leveys, double korkeus)
{
sammakko = new PhysicsObject(40.0, 26.0);
sammakko.Shape = Shape.Rectangle;
sammakko.X = x;
sammakko.Y = y;
sammakko.Color = Color.Green;
sammakko.Image = LoadImage("Sammakko.png");
sammakko.Position = paikka;
sammakko.CanRotate = false;
Add(sammakko);
......@@ -124,5 +127,34 @@ namespace Sammakkopeli
{
onkoHypannut = false;
}
public void LuoTaso(Vector paikka, double leveys, double korkeus)
{
PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus);
taso.Position = paikka;
taso.Shape = Shape.Rectangle;
taso.Color = Color.Orange;
taso.CollisionIgnoreGroup = 1;
Add(taso);
}
public void LuoHilleri(Vector paikka, double leveys, double korkeus)
{
PhysicsObject hilleri = new PhysicsObject(100, 70);
hilleri.IgnoresCollisionResponse = true;
hilleri.Position = paikka;
hilleri.Image = LoadImage("Hilleri.png");
Add(hilleri);
}
public void LuoKarpanen(Vector paikka, double leveys, double korkeus)
{
PhysicsObject karpanen = PhysicsObject.CreateStaticObject(leveys, korkeus);
karpanen.Position = paikka;
karpanen.Image = LoadImage("Karpane.png");
karpanen.IgnoresCollisionResponse = true;
karpanen.Tag = "karpanen";
Add(karpanen);
}
}
}
\ No newline at end of file
......@@ -13,10 +13,16 @@
</ItemGroup>
<ItemGroup>
<None Update="content\Kenttä.png">
<None Update="content\Hilleri.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="content\VainSammakko.png">
<None Update="content\Karpane.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="content\Kentta1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="content\Sammakko.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
......
Sammakkopeli/Sammakkopeli/content/Hilleri.png

1.74 KiB

Sammakkopeli/Sammakkopeli/content/Karpane.png

1.11 KiB

Sammakkopeli/Sammakkopeli/content/Kentta1.png

824 B

Sammakkopeli/Sammakkopeli/content/Kenttä.png

857 B

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