Fix anchor for lots roaches
[koperkapel.git] / koperkapel / vehicles / walking.py
index 91cf02df66372b8f33c22771fd43a7dfd4ad6006..6b57dff2c22fee29c0d80d42dfaddb9677216a6d 100644 (file)
@@ -1,9 +1,8 @@
 """ A vehicle to represent roaches on foot. """
 
 import math
-from pgzero.actor import Actor
 from .base import Vehicle, Seat
-
+from ..roaches import default_roaches, roaches_quartet, roaches_nonet, WorldRoach
 
 class Walking(Vehicle):
 
@@ -18,3 +17,21 @@ class Walking(Vehicle):
                 pos=(math.sin(i * d_theta), math.cos(i * d_theta)))
             for i in range(n_seats)
         ]
+
+    def get_avatar(self, world):
+        num_roaches = len(world.roaches)
+        roach = WorldRoach()
+        if num_roaches == 1:
+            # Return a single large roach
+            avatar = default_roaches.assemble(roach)
+            avatar.anchor = (0, 0)
+        elif num_roaches < 6:
+            avatar = roaches_quartet.assemble(roach)
+            avatar.anchor = (0, 0)
+        else:
+            avatar = roaches_nonet.assemble(roach)
+            avatar.anchor = (0, 0)
+        return avatar
+
+    def changed(self):
+        return False