def battle_init(self): self.subphase = None # Instanciate the camera handler self.camhandler = CameraHandler() # Instanciate the keyboard tile traverser self.inputs = KeyboardTileTraverser(self) # Instanciate the battle graphics self.battleGraphics = BattleGraphics(self.party['map']) # Light the scene self.battleGraphics.lightScene() # Display the terrain self.battleGraphics.displayTerrain() # Play the background music self.music = base.loader.loadSfx(GAME + '/music/' + self.party['map']['music'] + '.ogg') self.music.setLoop(True) self.music.play() # Load sounds self.hover_snd = base.loader.loadSfx(GAME + "/sounds/hover.ogg") self.clicked_snd = base.loader.loadSfx(GAME + "/sounds/clicked.ogg") self.cancel_snd = base.loader.loadSfx(GAME + "/sounds/cancel.ogg") self.attack_snd = base.loader.loadSfx(GAME + "/sounds/attack.ogg") self.die_snd = base.loader.loadSfx(GAME + "/sounds/die.ogg") # Place highlightable tiles on the map self.matrix = Matrix(self.battleGraphics, self.party['map']) self.matrix.placeChars(self.party['chars']) # Instanciate and hide the AT flag self.at = AT() self.at.hide() self.charbars = None self.charcard = None self.actionpreview = None # Generate the sky and attach it to the camera self.sky = Sky(self.party['map']) # Tasks taskMgr.add(self.characterDirectionTask, 'characterDirectionTask') # Cursor stuff self.cursor = Cursor(self.battleGraphics, self.matrix.container) # Add the special effects self.battleGraphics.addEffects() # Battle intro animation SequenceBuilder.battleIntroduction(self).start()
MAPS = os.path.join(SERVERGAME, 'maps', MAP) # Get map description file (JSON); ..\server\Map.py:9 f = open(MAPS, 'r') mapJSON = json.loads(f.read()) f.close() # Parse map description file in place of the JSON response the server sends; ..\server\Map.py:13 tiles = [[[None for z in range(mapJSON['z'])] for y in range(mapJSON['y'])] for x in range(mapJSON['x'])] for t in mapJSON['tiles']: tiles[int(t['x'])][int(t['y'])][int(t['z'])] = t # Add extra information back to the map description file in memory; ..\server\Map.py:17 mapJSON['tiles'] = tiles battleGraphics = None try: # Instanciate the battle graphics battleGraphics = BattleGraphics(mapJSON, GAME) # Display the terrain (map model is actually loaded here). battleGraphics.displayTerrain() except IOError: # Map couldn't be found. battleGraphics = None pass # If the map was loaded successfully, finish setting everything up and run the event. if not battleGraphics is None: # Light the scene battleGraphics.lightScene() # Bind camera controls to keys. camhandler = CameraHandler.CameraHandler() camhandler.accept('escape', lambda: sys.exit()) # Play the background music music = base.loader.loadSfx(GAME + '/music/' + mapJSON['music'] +