Skip to content
Snippets Groups Projects
Commit f3571e22 authored by Yli-Tainio Janne Sakri Juhani's avatar Yli-Tainio Janne Sakri Juhani
Browse files

olio liikkuu

parent 112186f9
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,8 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0cb08879-2df4-4f3a-a1a9-8178f387d135" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/kolikkogoblin/content/palikka.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.kolikkogoblin/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.kolikkogoblin/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/Ohjelma.cs" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/Ohjelma.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/content/goblin1.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/content/goblin2.png" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/content/goblin2.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/content/goblin3.png" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/content/goblin3.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/content/kolikko.png" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/content/kolikko.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/content/piikkeja.png" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/content/piikkeja.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/kolikkogoblin.cs" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/kolikkogoblin.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/kolikkogoblin/kolikkogoblin.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/kolikkogoblin/kolikkogoblin.csproj" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -91,7 +83,7 @@
<workItem from="1697968144137" duration="544000" />
<workItem from="1697968850249" duration="1577000" />
<workItem from="1697970578826" duration="3648000" />
<workItem from="1697975844304" duration="1009000" />
<workItem from="1697975844304" duration="5156000" />
</task>
<servers />
</component>
......
......@@ -14,18 +14,6 @@ namespace Kolikkogoblin;
public class Kolikkogoblin : PhysicsGame
{
private static readonly String[] lines = {
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
......@@ -34,16 +22,11 @@ public class Kolikkogoblin : PhysicsGame
" X ",
" X ",
" X ",
" * XXX ",
" XXX ",
" ww g ",
" * ",
" XXX ",
" w w g ",
};
private readonly Image palikka = LoadImage("palikka");
private readonly Image goblin = LoadImage("goblin1");
private readonly Image kolikko = LoadImage("kolikko");
private readonly Image piikkeja = LoadImage("piikkeja");
private static readonly int tileWidth = 800 / lines[0].Length;
private static readonly int tileHeight = 480 / lines.Length;
......@@ -63,7 +46,8 @@ public class Kolikkogoblin : PhysicsGame
Level.CreateBorders();
Camera.ZoomToLevel();
PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");
Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");
}
......@@ -71,7 +55,7 @@ public class Kolikkogoblin : PhysicsGame
private void LuoPalikka(Vector paikka, double leveys, double korkeus, Color vari)
{
PhysicsObject palikka = new PhysicsObject(leveys * 1.6, korkeus);
PhysicsObject palikka = new PhysicsObject(leveys , korkeus);
palikka.Position = paikka;
palikka.Color = vari;
palikka.Tag = "rakenne";
......@@ -88,14 +72,24 @@ public class Kolikkogoblin : PhysicsGame
kolikko.Image = LoadImage("kolikko");
Add(kolikko);
}
private void LuoGoblin(Vector paikka, double leveys, double korkeus, Color vari)
{
PhysicsObject goblin = PhysicsObject.CreateStaticObject(leveys * 3 , korkeus * 6);
{
PlatformCharacter goblin = new PlatformCharacter(leveys*2 , korkeus *2);
goblin.Position = paikka;
goblin.Color = vari;
goblin.Image = LoadImage("goblin1");
Add(goblin);
Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-20000, 0));
Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(20000, 0));
Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 7000));
Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -7000));
void LiikutaPelaajaa(Vector vektori)
{
goblin.Push(vektori);
}
}
private void LuoPiikkeja(Vector paikka, double leveys, double korkeus, Color vari)
......@@ -108,6 +102,5 @@ public class Kolikkogoblin : PhysicsGame
piikkeja.Tag = "piikkeja";
Add(piikkeja);
}
}
}
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