From: Simon Cross Date: Sat, 5 Mar 2016 15:35:43 +0000 (+0200) Subject: More vehicles! X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=5d47fb682df83ec2fb5e4e9851a4508e39498695;p=koperkapel.git More vehicles! --- diff --git a/koperkapel/scenes/roach_management.py b/koperkapel/scenes/roach_management.py index 77100ab..4cc0395 100644 --- a/koperkapel/scenes/roach_management.py +++ b/koperkapel/scenes/roach_management.py @@ -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): diff --git a/koperkapel/vehicles/base.py b/koperkapel/vehicles/base.py index dec2aca..2ae347c 100644 --- a/koperkapel/vehicles/base.py +++ b/koperkapel/vehicles/base.py @@ -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) diff --git a/koperkapel/vehicles/quadcopter.py b/koperkapel/vehicles/quadcopter.py index ed5024f..64f921f 100644 --- a/koperkapel/vehicles/quadcopter.py +++ b/koperkapel/vehicles/quadcopter.py @@ -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) diff --git a/koperkapel/vehicles/robot.py b/koperkapel/vehicles/robot.py index 50ebc13..8fe3fa9 100644 --- a/koperkapel/vehicles/robot.py +++ b/koperkapel/vehicles/robot.py @@ -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) diff --git a/koperkapel/vehicles/roomba.py b/koperkapel/vehicles/roomba.py index ff93f8a..c868763 100644 --- a/koperkapel/vehicles/roomba.py +++ b/koperkapel/vehicles/roomba.py @@ -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)