Moar vehicles!
[koperkapel.git] / koperkapel / vehicles / walking.py
index f8198923d921d61f1809b18746fd5833540233aa..f7b73aa398cbf31ca6451f0b117bd0c980e00139 100644 (file)
@@ -1,17 +1,28 @@
 """ A vehicle to represent roaches on foot. """
 
-import math
-from .base import Vehicle, Seat
-from ..actors.buttons import TextButton
+from .base import Vehicle, circle_of_seats
+from ..roaches import (
+    default_roaches, roaches_quartet, roaches_nonet, WorldRoach)
 
 
 class Walking(Vehicle):
 
-    def __init__(self):
-        n_seats = 6
-        d_theta = 2 * math.pi / n_seats
-        self.seats = [
-            Seat(pos=(math.sin(i * d_theta), math.cos(i * d_theta)))
-            for i in range(n_seats)
-        ]
-        self.background = TextButton("Walking Background")
+    vehicle_type = "walking"
+
+    def init_seats(self):
+        return circle_of_seats(6, vehicle=self)
+
+    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