X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=koperkapel%2Fvehicles%2Fwalking.py;h=8061f2c31c94e83689d286907252f2d61cbaaaca;hb=359505e8ab4874f750103bcdc6222207bf52722a;hp=adcdfc931f87b276e7d3be3e79ad54069076ad52;hpb=6cb552f903dce3e3bad9b3f3be829f0996422ae2;p=koperkapel.git diff --git a/koperkapel/vehicles/walking.py b/koperkapel/vehicles/walking.py index adcdfc9..8061f2c 100644 --- a/koperkapel/vehicles/walking.py +++ b/koperkapel/vehicles/walking.py @@ -1,19 +1,32 @@ """ A vehicle to represent roaches on foot. """ -import math -from pgzero.actor import Actor -from .base import Vehicle, Seat +from .base import Vehicle, circle_of_seats +from ..roaches import ( + default_roaches, roaches_quartet, roaches_nonet, WorldRoach) +from ..weapons import default_weapons class Walking(Vehicle): - def __init__(self): - self.background = Actor("vehicles/walking/background") - n_seats = 6 - d_theta = 2 * math.pi / n_seats - self.seats = [ - Seat( - actor=Actor("vehicles/walking/seat"), - pos=(math.sin(i * d_theta), math.cos(i * d_theta))) - for i in range(n_seats) - ] + vehicle_type = "walking" + weapons_taped_on = False + + def init_seats(self): + return circle_of_seats(6, vehicle=self) + + def get_avatar(self, world): + weapon = default_weapons.assemble( + world.weapons.current, tape=self.weapons_taped_on) + num_roaches = len(world.roaches) + roach = WorldRoach() + if num_roaches == 1: + # Return a single large roach + avatar = default_roaches.assemble(roach, weapon) + avatar.anchor = (0, 0) + elif num_roaches < 6: + avatar = roaches_quartet.assemble(roach, weapon) + avatar.anchor = (0, 0) + else: + avatar = roaches_nonet.assemble(roach, weapon) + avatar.anchor = (0, 0) + return avatar