Mercurial > rinkhals
comparison gamelib/tiles.py @ 505:3ed6c011106d
Switch to classmethod decorators.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Thu, 26 Nov 2009 22:34:58 +0000 |
parents | e3408c803b12 |
children | 11c4cebfe4c5 |
comparison
equal
deleted
inserted
replaced
504:393e30ea0165 | 505:3ed6c011106d |
---|---|
105 | 105 |
106 def __init__(self): | 106 def __init__(self): |
107 tilevid.Tilevid.__init__(self) | 107 tilevid.Tilevid.__init__(self) |
108 self.sprites = LayeredSprites(['buildings', 'animals', 'animations', 'cursor'], 'animals') | 108 self.sprites = LayeredSprites(['buildings', 'animals', 'animations', 'cursor'], 'animals') |
109 | 109 |
110 @classmethod | |
110 def make(cls): | 111 def make(cls): |
111 """Override default Simplifiable object creation.""" | 112 """Override default Simplifiable object creation.""" |
112 return cls() | 113 return cls() |
113 make = classmethod(make) | |
114 | 114 |
115 @classmethod | |
115 def unsimplify(cls, *args, **kwargs): | 116 def unsimplify(cls, *args, **kwargs): |
116 """Override default Simplifiable unsimplification.""" | 117 """Override default Simplifiable unsimplification.""" |
117 obj = serializer.Simplifiable.unsimplify(*args, **kwargs) | 118 obj = serializer.Simplifiable.unsimplify(*args, **kwargs) |
118 | 119 |
119 obj.view.x, obj.view.y = 0,0 | 120 obj.view.x, obj.view.y = 0,0 |
120 obj._view.x, obj._view.y = 0,0 | 121 obj._view.x, obj._view.y = 0,0 |
121 obj.bounds = None | 122 obj.bounds = None |
122 obj.updates = [] | 123 obj.updates = [] |
123 | 124 |
124 return obj | 125 return obj |
125 unsimplify = classmethod(unsimplify) | |
126 | 126 |
127 def png_folder_load_tiles(self, path): | 127 def png_folder_load_tiles(self, path): |
128 """Load tiles from a folder of PNG files.""" | 128 """Load tiles from a folder of PNG files.""" |
129 full_path = data.filepath(path) | 129 full_path = data.filepath(path) |
130 for dirpath, dirnames, filenames in os.walk(full_path): | 130 for dirpath, dirnames, filenames in os.walk(full_path): |