From 4c6c12027a365c39ca8ca676e25b65b5eb9bd039 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Wed, 2 Mar 2016 23:53:03 +0200 Subject: [PATCH] Make layers iterable. --- koperkapel/scenes/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.34.1