Skip to content
Snippets Groups Projects
Commit 1937b12d authored by Sulasalmi Aleksi Sakari's avatar Sulasalmi Aleksi Sakari
Browse files

lokit ei törmää toisiinsa

parent 306d147a
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@ public class Lokkihunter : PhysicsGame
Vector nopeusOikea = new Vector(-200, 0);
private PhysicsObject pekka;
private PhysicsObject lokki;
private PhysicsObject lokkiVasen;
private PhysicsObject lokkiOikea;
private PhysicsObject alaReuna;
private PhysicsObject ylaReuna;
......@@ -92,31 +93,41 @@ public class Lokkihunter : PhysicsGame
private void LuoLokkiVasen()
{
lokki = new PhysicsObject(60.0, 20.0);
lokki.Shape = Shape.Rectangle;
lokki.Hit(new Vector(80, 1));
lokkiVasen = new PhysicsObject(60.0, 20.0);
lokkiVasen.Shape = Shape.Rectangle;
lokkiVasen.Hit(new Vector(80, 1));
double x = -400;
lokki.X = x;
lokkiVasen.X = x;
double y = RandomGen.NextDouble(200, 350);
lokki.Y = y;
lokkiVasen.Y = y;
Add(lokki);
Add(lokkiVasen);
}
private void LuoLokkiOikea()
{
lokki = new PhysicsObject(60.0, 20.0);
lokki.Shape = Shape.Rectangle;
lokki.Hit(new Vector(-80, 1));
lokkiOikea = new PhysicsObject(60.0, 20.0);
lokkiOikea.Shape = Shape.Rectangle;
lokkiOikea.Hit(new Vector(-80, 1));
double x = 400;
lokki.X = x;
double y = RandomGen.NextDouble(200, 350);
lokki.Y = y;
lokkiOikea.X = x;
double y;
do
{
y = RandomGen.NextDouble(200, 350);
} while (Math.Abs(y - lokkiVasen.Y) < 40);
lokkiOikea.Y = y;
Add(lokki);
Add(lokkiOikea);
}
// törmäys vasen ja oikea reuna
// ase
// pisteet
// kentät
// kommentit
}
\ No newline at end of file
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