gummworld2.basicmap (version $Id: basicmap.py 427 2013-08-26 04:25:04Z stabbingfinger@gmail.com $) | index c:\cygwin64\home\bw\dev\python\dist\gummworld2\gamelib\gummworld2\basicmap.py |
basicmap.py - Basic Map module for Gummworld2.
Defines the BasicMap, which serves layers and sprite objects.
BasicMap combines view (pygame) and model (world coordinates). It contains a
rect attribute defining its dimensions, and observes pygame coordinate space.
The layers attribute is a spatialhash containing sprites. This can be
accessed directly, or via the class methods. See also the toolkit module for
convenience utilities.
The caller must manage maps and their corresponding worlds by swapping the
State.map and State.world package globals, for example:
# Create the initial map and world, and save it.
State.map = BasicMap(width, height, tile_width, tile_height)
State.world = model.World(State.map.rect)
levels = []
levels.append((State.map,State.world))
...
# Create a new one, save it.
State.map = BasicMap(new_width, new_height, new_tile_width, new_tile_height)
State.world = model.World(State.map.rect)
levels.append((State.map,State.world))
...
# Restore a map and world.
State.map,State.world = levels[0]
Alternatively State.save() and State.restore() can be used to facilitate this.
Modules | ||||||
|
Classes | ||||||||||||||
|
Functions | ||
|
Data | ||
__all__ = ['BasicMap', 'BasicLayer', 'collapse_layer', 'blit_layer'] __author__ = 'Gummbum, (c) 2011-2014' __version__ = '$Id: basicmap.py 427 2013-08-26 04:25:04Z stabbingfinger@gmail.com $' |
Author | ||
Gummbum, (c) 2011-2014 |