More vehicles!
authorSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 15:35:43 +0000 (17:35 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 15:35:43 +0000 (17:35 +0200)
koperkapel/scenes/roach_management.py
koperkapel/vehicles/base.py
koperkapel/vehicles/quadcopter.py
koperkapel/vehicles/robot.py
koperkapel/vehicles/roomba.py

index 77100ab7435290d03f7c77d10e45aac171339427..4cc0395ae1e668abbcb4978f425f6d6d47f9d870 100644 (file)
@@ -67,6 +67,9 @@ class RoachesScene(Scene):
         else:
             base.fill((10, 10, 10))
         base.blit(overlay, (0, 0))
+        frame = self._vehicle.roach_management_frame()
+        if frame is not None:
+            base.blit(frame, (0, 0))
         self.actors.default.add(SurfActor(base))
 
     def _init_seats(self):
index dec2aca44e3d2ea2b87c17a5d594ad1a171944a5..2ae347cd54e541187b46cd39729da98a7cc86f2b 100644 (file)
@@ -12,6 +12,7 @@ class Vehicle:
     """ Vehicle base class. """
 
     vehicle_type = None
+    overlay_frame_no = None
     approximate_radius = 200
     selected_seat_overlay_color = (255, 0, 0, 255)
 
@@ -20,7 +21,13 @@ class Vehicle:
         self.game_pos = (0, 0)
 
     def roach_management_overlay(self):
-        return images.load("vehicles/%s/background" % (self.vehicle_type,))
+        return images.load("vehicles/walking/background")
+
+    def roach_management_frame(self):
+        if self.overlay_frame_no is None:
+            return None
+        return images.load("vehicle_big/%s_%d" % (
+            self.vehicle_type, self.overlay_frame_no))
 
     def init_seats(self):
         raise NotImplementedError("Vehicles should specify a list of seats")
@@ -85,7 +92,7 @@ class Vehicle:
 
     def get_avatar(self, world):
         frames = [self._avatar_frame(i) for i in range(4)]
-        return AnimatedSurfActor(frames)
+        return AnimatedSurfActor(frames, anchor=(0, 0))
 
 
 class Seat:
@@ -108,8 +115,7 @@ class Seat:
         self.vehicle_pos = (pos[0] * vrad, pos[1] * vrad)
 
     def actor(self):
-        seat = images.load(
-            "vehicles/%s/seat" % (self.vehicle.vehicle_type,))
+        seat = images.load("vehicles/walking/seat")
         selected_seat = seat.copy()
         selected_seat.fill(
             self.vehicle.selected_seat_overlay_color, None, BLEND_RGBA_MULT)
index ed5024fb9dc1beccfd651e932462d798289700f5..64f921f2edb989bec918055e7a93385e12ba7ee0 100644 (file)
@@ -6,6 +6,7 @@ from .base import Vehicle, circle_of_seats
 class Quadcopter(Vehicle):
 
     vehicle_type = "quadcopter"
+    overlay_frame_no = 1
 
     def init_seats(self):
         return circle_of_seats(4, vehicle=self)
index 50ebc138f4d81d4c91bcec6f7320a81817b52497..8fe3fa93a88d65144cfa0f08bc3bca888290675e 100644 (file)
@@ -6,6 +6,7 @@ from .base import Vehicle, circle_of_seats
 class Robot(Vehicle):
 
     vehicle_type = "robot"
+    overlay_frame_no = 1
 
     def init_seats(self):
         return circle_of_seats(8, vehicle=self)
index ff93f8a989caab591e14667b4cfa4c1b9ae5ac6a..c868763ad47f412626e36e4434ca5de793b58333 100644 (file)
@@ -6,6 +6,7 @@ from .base import Vehicle, circle_of_seats
 class Roomba(Vehicle):
 
     vehicle_type = "roomba"
+    overlay_frame_no = 1
 
     def init_seats(self):
         return circle_of_seats(6, vehicle=self)