From: Simon Cross Date: Wed, 2 Mar 2016 21:53:03 +0000 (+0200) Subject: Make layers iterable. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=4c6c12027a365c39ca8ca676e25b65b5eb9bd039;p=koperkapel.git Make layers iterable. --- diff --git a/koperkapel/scenes/base.py b/koperkapel/scenes/base.py index fd53f81..16353d5 100644 --- a/koperkapel/scenes/base.py +++ b/koperkapel/scenes/base.py @@ -116,6 +116,9 @@ class Layer: self.name = name self.actors = [] + def __iter__(self): + return iter(self.actors) + def add(self, actor): self.actors.append(actor) return actor @@ -154,7 +157,7 @@ class Actors: def draw(self, screen): for lvl, name in self._ordered_layers: - for actor in self._layers[name].actors: + for actor in self._layers[name]: actor.draw() # TODO: allow an option screen to be passed in