From 0b684f3e74a69b93c8b0510b09ff51fa351582b9 Mon Sep 17 00:00:00 2001
From: Miettinen Miklas <miklas.miettinen@gmail.com>
Date: Wed, 18 Dec 2024 13:39:20 +0200
Subject: [PATCH] =?UTF-8?q?slotit=20korjattu(ehk=C3=A4(ei=20voi=20ikin?=
 =?UTF-8?q?=C3=A4=20tite=C3=A4=C3=A4))?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Financial_Freedom/Financial_Freedom.cs    | 34 ++++++++++---------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs b/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs
index 8d64df4..e6c43a0 100644
--- a/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs
+++ b/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs
@@ -1456,22 +1456,18 @@ public class  Financial_Freedom : PhysicsGame
         
         while (!slotitPysaytetty)
         {
-            if (!slotitPysaytetty)
+            foreach (var slot in slots)
             {
-                foreach (var slot in slots)
-                {
-                    
-                    slot.Velocity = nopeus;
-                    slot.Collided += (ptpl, stoppalkki) =>
-                    {
-                        if (ptpl == slot && stoppalkki == stopper)
-                        {
-                            slot.Velocity = nopeus;
-                            slot.Position = new Vector(slot.Position.X, Level.Top + 200);
-                            slot.Image = slotImages[RandomGen.NextInt(0, slotImages.Length)];
-                        }
-                    };
-                }   
+                slot.Velocity = nopeus; 
+                slot.Collided += (ptpl, stoppalkki) => 
+                { 
+                    if (ptpl == slot && stoppalkki == stopper && !slotitPysaytetty) 
+                    { 
+                        slot.Velocity = nopeus; 
+                        slot.Position = new Vector(slot.Position.X, Level.Top + 200); 
+                        slot.Image = slotImages[RandomGen.NextInt(0, slotImages.Length)];
+                    } 
+                };
             }
             Keyboard.Listen(Key.Space, ButtonState.Pressed, () =>
             {
@@ -1486,10 +1482,10 @@ public class  Financial_Freedom : PhysicsGame
                                 slot.Stop();
                                 slot.MakeStatic();
                             }
+                            slotitPysaytetty = true;
                         }
                     };
                 };
-                slotitPysaytetty = true;
             }, "pysäyttää slotit");
             await Task.Delay(100);
         }
@@ -1503,8 +1499,14 @@ public class  Financial_Freedom : PhysicsGame
         TakaisinPV();
     }
 
+    
+    /// <summary>
+    /// tarkistaa paljonko rahaa pitää antaa takaisin ja antaa sen
+    /// </summary>
+   
     public void TseggaaPisteet(PhysicsObject[,] slotsGrid, Image[] slotImages)
     {
+        
        
         int rivit = slotsGrid.GetLength(0);
         int kerrokset = slotsGrid.GetLength(1);
-- 
GitLab