From 91da0245b57ebe54f9168fdbc1c97d5981232198 Mon Sep 17 00:00:00 2001 From: Peter Ward Date: Mon, 28 Sep 2009 10:30:13 +1000 Subject: Added a pretty apple image. --- common.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common.py') diff --git a/common.py b/common.py index f19ebd9..7ccf8e9 100644 --- a/common.py +++ b/common.py @@ -1,4 +1,19 @@ +import os + class Squares(object): EMPTY = '.' APPLE = '*' +class Sprites(object): + PREFIX = 'images' + def __getattribute__(self, name): + try: + return object.__getattribute__(self, name.upper()) + except AttributeError: + from pygame.image import load + filename = os.path.join(self.PREFIX, name.lower() + ".png") + image = load(filename).convert_alpha() + setattr(self, name, image) + return image +Sprites = Sprites() + -- cgit v1.2.3