From 4abe072be52c3c55067921df0ec6553adf4cff96 Mon Sep 17 00:00:00 2001
From: Lehtinen Anni Henriikka <lehtineah@gmail.com>
Date: Mon, 31 Mar 2025 00:15:22 +0300
Subject: [PATCH] =?UTF-8?q?Pistelaskuri=20lis=C3=A4tty?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Escape/Escape/Escape.cs | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Escape/Escape/Escape.cs b/Escape/Escape/Escape.cs
index 0b6e9b8..1925181 100644
--- a/Escape/Escape/Escape.cs
+++ b/Escape/Escape/Escape.cs
@@ -8,12 +8,14 @@ using Jypeli.Widgets;
 namespace Escape;
 
 /// @author annilehtinen
-/// @version 30.03.2025 / 3
+/// @version 31.03.2025
 /// <summary>
 /// Peli, jossa pelaajaan tavoitteena on vältellä vastustajaa (Barkov) ja kerätä kiekkoja saadakseen pisteitä.
 /// </summary>
 public class Escape : PhysicsGame
 {
+    private IntMeter _pointCounter;
+    
     public override void Begin()
     {
         Camera.ZoomToLevel();
@@ -111,6 +113,7 @@ public class Escape : PhysicsGame
     void CollectPuck(PhysicsObject player, PhysicsObject puck)
     {
         puck.Destroy();
+        _pointCounter.Value += 1;
     }
     
     
@@ -173,6 +176,20 @@ public class Escape : PhysicsGame
     void CreateLevel()
     {
         Surfaces borders = Level.CreateBorders(0.5, true, Color.White);
+        CreatePointCounter();
         SpawnPucks(5, 10.0);
     }
+    
+    void CreatePointCounter()
+    {
+        _pointCounter = new IntMeter(0);               
+      
+        Label pistenaytto = new Label(); 
+        pistenaytto.X = Screen.Right -140;
+        pistenaytto.Y = Screen.Top -30;
+        pistenaytto.TextColor = Color.White;
+        pistenaytto.Title = "Pucks collected: ";
+        pistenaytto.BindTo(_pointCounter);
+        Add(pistenaytto);
+    }
 }
\ No newline at end of file
-- 
GitLab