From c9b9152a1470e39468a95d654e2b7a3679dcda9f Mon Sep 17 00:00:00 2001
From: fheinrich <fheinrich@techfak.uni-bielefeld.de>
Date: Wed, 3 Jan 2024 14:22:59 +0100
Subject: [PATCH] Corrected center offset when visualizing circles

---
 overcooked_simulator/pygame_gui/pygame_gui.py |  3 +--
 .../pygame_gui/visualization.yaml             | 20 +++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/overcooked_simulator/pygame_gui/pygame_gui.py b/overcooked_simulator/pygame_gui/pygame_gui.py
index 610bdc89..7e4dfae2 100644
--- a/overcooked_simulator/pygame_gui/pygame_gui.py
+++ b/overcooked_simulator/pygame_gui/pygame_gui.py
@@ -341,7 +341,7 @@ class PyGameGUI:
                         pygame.draw.circle(
                             self.screen,
                             color,
-                            (pos * self.grid_size) + np.array(part["center_offset"]),
+                            pos + (np.array(part["center_offset"])*self.grid_size),
                             radius,
                         )
                     else:
@@ -382,7 +382,6 @@ class PyGameGUI:
     def draw_progress_bar(self, pos, current, needed):
         """Visualize progress of progressing item as a green bar under the item."""
         if current != 0:
-            pos = pos * self.grid_size
             bar_height = self.grid_size * 0.2
             progress_width = (current / needed) * self.grid_size
             progress_bar = pygame.Rect(
diff --git a/overcooked_simulator/pygame_gui/visualization.yaml b/overcooked_simulator/pygame_gui/visualization.yaml
index 31735993..cc229b5e 100644
--- a/overcooked_simulator/pygame_gui/visualization.yaml
+++ b/overcooked_simulator/pygame_gui/visualization.yaml
@@ -176,11 +176,11 @@ ChoppedLettuce:
     - type: circle
       radius: 0.3
       color: black
-      center_offset: [ -5, 0 ]
+      center_offset: [ -0.125, 0 ]
     - type: circle
       radius: 0.25
       color: emeraldgreen
-      center_offset: [ -5, 0 ]
+      center_offset: [ -0.125, 0 ]
     - type: circle
       radius: 0.3
       color: black
@@ -190,11 +190,11 @@ ChoppedLettuce:
     - type: circle
       radius: 0.3
       color: black
-      center_offset: [ 5, 0 ]
+      center_offset: [ 0.125, 0 ]
     - type: circle
       radius: 0.25
       color: emeraldgreen
-      center_offset: [ 5, 0 ]
+      center_offset: [ 0.125, 0 ]
 
 ChoppedTomato:
   parts:
@@ -207,11 +207,11 @@ ChoppedOnion:
     - type: circle
       radius: 0.3
       color: black
-      center_offset: [ -5, 0 ]
+      center_offset: [ -0.125, 0 ]
     - type: circle
       radius: 0.25
       color: deeppink4
-      center_offset: [ -5, 0 ]
+      center_offset: [ -0.125, 0 ]
     - type: circle
       radius: 0.3
       color: black
@@ -221,22 +221,22 @@ ChoppedOnion:
     - type: circle
       radius: 0.3
       color: black
-      center_offset: [ 5, 0 ]
+      center_offset: [ 0.125, 0 ]
     - type: circle
       radius: 0.25
       color: deeppink4
-      center_offset: [ 5, 0 ]
+      center_offset: [ 0.125, 0 ]
 
 ChoppedMeat:
   parts:
     - type: circle
       radius: 0.3
       color: black
-      center_offset: [ -5, 0 ]
+      center_offset: [ -0.125, 0 ]
     - type: circle
       radius: 0.25
       color: indianred1
-      center_offset: [ -5, 0 ]
+      center_offset: [ -0.125, 0 ]
     - type: circle
       radius: 0.3
       color: black
-- 
GitLab