Skip to content
Snippets Groups Projects
Commit 93bd212a authored by Pekka Pihlajamaa's avatar Pekka Pihlajamaa
Browse files

Ohjaimet saatu haltuun

parent 29f59ca5
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ namespace Hiko ...@@ -12,6 +12,7 @@ namespace Hiko
{ {
PhysicsObject pelaaja; PhysicsObject pelaaja;
GameObject tahtain;
public override void Begin() public override void Begin()
{ {
// Kirjoita ohjelmakoodisi tähän // Kirjoita ohjelmakoodisi tähän
...@@ -21,6 +22,7 @@ namespace Hiko ...@@ -21,6 +22,7 @@ namespace Hiko
LuoPelaaja(); LuoPelaaja();
Gravity = new Vector(0.0, -981.0); Gravity = new Vector(0.0, -981.0);
LuoOhjaimet(); LuoOhjaimet();
LuoTahtain();
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");
} }
...@@ -34,6 +36,13 @@ namespace Hiko ...@@ -34,6 +36,13 @@ namespace Hiko
Add(pelaaja); Add(pelaaja);
return pelaaja; return pelaaja;
} }
GameObject LuoTahtain()
{
tahtain = new GameObject(30.0, 30.0, Shape.Circle);
tahtain.Image = LoadImage("tähtäinristikko");
Add(tahtain);
return tahtain;
}
public void LuoOhjaimet() public void LuoOhjaimet()
{ {
Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0)); Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0));
...@@ -50,8 +59,8 @@ namespace Hiko ...@@ -50,8 +59,8 @@ namespace Hiko
} }
void KuunteleLiiketta() void KuunteleLiiketta()
{ {
pelaaja.X = Mouse.PositionOnWorld.X; tahtain.X = Mouse.PositionOnWorld.X;
pelaaja.Y = Mouse.PositionOnWorld.Y; tahtain.Y = Mouse.PositionOnWorld.Y;
} }
} }
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
<None Update="Content\pääjehu.png"> <None Update="Content\pääjehu.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="Content\tähtäinristikko.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>
......
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