+ def update(self, world, dt):
+ for i, roach in enumerate(world.roaches):
+ if roach["name"] in self._roach_actors:
+ actor = self._roach_actors[roach["name"]]
+ else:
+ actor = TextButton("%s [%s]" % (
+ roach["name"],
+ ", ".join("%s=%s" % kv for kv in sorted(
+ roach["attributes"].items()),
+ )))
+ self._roach_actors[roach["name"]] = actor
+ self.actors.add(actor)
+ # TODO: remove missing roaches
+ actor.pos = (300, 100 + i * 100)