X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=koperkapel%2Fvehicles%2Fwalking.py;h=aa88bc65a97230d5048f01927e43b4cddcdfbc1c;hb=20d1e19f23c04daf107ede8c9fe57b97005a37fd;hp=f8198923d921d61f1809b18746fd5833540233aa;hpb=6c6ebfbe8d8cbd476c94a5030bc1ab9e7d858f6d;p=koperkapel.git diff --git a/koperkapel/vehicles/walking.py b/koperkapel/vehicles/walking.py index f819892..aa88bc6 100644 --- a/koperkapel/vehicles/walking.py +++ b/koperkapel/vehicles/walking.py @@ -2,16 +2,35 @@ import math from .base import Vehicle, Seat -from ..actors.buttons import TextButton - +from ..roaches import default_roaches, roaches_quartet, roaches_nonet, WorldRoach class Walking(Vehicle): - def __init__(self): + vehicle_type = "walking" + + def init_seats(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))) + return [ + Seat( + vehicle=self, + pos=(math.sin(i * d_theta), math.cos(i * d_theta))) for i in range(n_seats) ] - self.background = TextButton("Walking Background") + + 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 = (-16, 0) + else: + avatar = roaches_nonet.assemble(roach) + return avatar + + def changed(self): + return False