From 1937b12d7add8e4a4f4f7ebe15117562c137151e Mon Sep 17 00:00:00 2001
From: Sulasalmi Aleksi Sakari <aleksi.s.sulasalmi@student.jyu.fi>
Date: Mon, 23 Oct 2023 20:02:54 +0300
Subject: [PATCH] =?UTF-8?q?lokit=20ei=20t=C3=B6rm=C3=A4=C3=A4=20toisiinsa?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Lokkihunter/Lokkihunter.cs"               | 41 ++++++++++++-------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git "a/Harjoitusty\303\266/Lokkihunter/Lokkihunter.cs" "b/Harjoitusty\303\266/Lokkihunter/Lokkihunter.cs"
index b35c04d..b32ea77 100644
--- "a/Harjoitusty\303\266/Lokkihunter/Lokkihunter.cs"
+++ "b/Harjoitusty\303\266/Lokkihunter/Lokkihunter.cs"
@@ -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
-- 
GitLab