def installWorldBall(self, context, myWorldBall, loadBall=None ): #print myWorldBall self.worldArray = [] if context == 'editor': for mB in myWorldBall[0]: self.worldArray.append( generalmap.edMap(mB) ) self.initialMap = self.getMapByName( myWorldBall[1] ) self.currentMap = self.getMapByName( myWorldBall[1] ) elif context == 'game': for mB in myWorldBall[0]: #print mB self.worldArray.append( generalmap.gameMap(mB, None) ) if loadBall is not None: for mB in loadBall[0]: newMap = generalmap.gameMap(mB) self.worldArray.append( newMap ) if newMap.up[0] != 'dungeon': self.getMapByName(newMap.up[0]).down = ( newMap.getName(), ) if newMap.down[0] != 'dungeon': self.getMapByName(newMap.down[0]).up = ( newMap.getName(), ) self.initialMap = self.getMapByName( loadBall[1] ) self.currentMap = self.getMapByName( loadBall[2] ) else: self.initialMap = self.getMapByName( myWorldBall[1] ) self.currentMap = self.getMapByName( myWorldBall[2] )
def __init__(self, context, myWorldBall=None, loadWorld=None): if context == 'editor': self.worldArray = [] self.addMap( None, generalmap.edMap() ) self.currentMap = self.worldArray[0] #self.initialMap = self.currentMap.name # number of maps in array # by default, world must have at least 1 map self.worldSize = 1 elif context == 'game': if loadWorld is not None: self.installWorldBall(context, myWorldBall, loadWorld, ) else: self.installWorldBall(context, myWorldBall, None, )
def addMap(self, title=None, nMap=None): if nMap is not None: self.worldArray.append(nMap) elif title is not None: self.worldArray.append( generalmap.edMap(None, title) )
screen.blit(self.sideImg, (1200, 0)) # Set the height and width of the screen size = [1400, 800] screen = pygame.display.set_mode(size) images.load() mapImages = images.mapImages pygame.init() pygame.key.set_repeat(50, 100) clock = pygame.time.Clock() cursorPos = (0, 0) myMap = generalmap.edMap() myHandler = Handler(cursorPos) blocksize = 30 gridField = pygame.Surface( [2 * const.DIM * blocksize, 2 * const.DIM * blocksize]) os.sys.setrecursionlimit(15000) def main(): while True: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: myHandler.event_handler(event)
screen.blit(self.sideImg, (1200, 0)) # Set the height and width of the screen size = [1400, 800] screen = pygame.display.set_mode(size) images.load() mapImages = images.mapImages pygame.init() pygame.key.set_repeat(50, 100) clock = pygame.time.Clock() cursorPos = (0, 0) myMap = generalmap.edMap() myHandler = Handler(cursorPos) blocksize = 30 gridField = pygame.Surface([2 * const.DIM * blocksize, 2 * const.DIM * blocksize]) os.sys.setrecursionlimit(15000) def main(): while True: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: myHandler.event_handler(event) if event.type == pygame.MOUSEBUTTONDOWN: