X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=koperkapel%2Fvehicles%2Fwalking.py;h=f7b73aa398cbf31ca6451f0b117bd0c980e00139;hb=350438a376706e28ab1d8de5ad78875bd99815bb;hp=9c19aa2264e7f730e0a4ea303b4c7e5310944848;hpb=803254edba328148045841cd2cbdc0e4bd19655b;p=koperkapel.git diff --git a/koperkapel/vehicles/walking.py b/koperkapel/vehicles/walking.py index 9c19aa2..f7b73aa 100644 --- a/koperkapel/vehicles/walking.py +++ b/koperkapel/vehicles/walking.py @@ -1,7 +1,8 @@ """ A vehicle to represent roaches on foot. """ -import math -from .base import Vehicle, Seat +from .base import Vehicle, circle_of_seats +from ..roaches import ( + default_roaches, roaches_quartet, roaches_nonet, WorldRoach) class Walking(Vehicle): @@ -9,11 +10,19 @@ class Walking(Vehicle): vehicle_type = "walking" def init_seats(self): - n_seats = 6 - d_theta = 2 * math.pi / n_seats - return [ - Seat( - vehicle=self, - pos=(math.sin(i * d_theta), math.cos(i * d_theta))) - for i in range(n_seats) - ] + 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