def start(self): self.hud = loading.Loading(my.ENGINE.screen) self.map = map.Map(self.width, self.height, self.seed) self.map.generate() self.hud.setStatus('Carregando entidades...', 80) spawnX = randint(50, self.width - 50) self.player = entities.Player(self, self.playerConfigurations[0], tank.TankDefault(), (spawnX, self.map.getMaxHeight(spawnX))) self.entities = camera.CameraAwareLayeredUpdates( self.player, pygame.Rect(0, 0, self.width, self.height)) self.entities.add( self.map ) # Adicionando o mapa em entidades para poder ser scrollado for i in range(0, self.enemiesCount): x = randint(50, self.width - 50) self.entities.add( entities.Enemy(self, tank.TankDefault(), (x, self.map.getMaxHeight(x)))) self.hud.setStatus('Carregando interface...', 99) self.hud = hud.Hud(self, my.ENGINE.screen) my.ENGINE.interface = self.hud self.turncontroller = turn.TurnController(self) self.turncontroller.start() self.wind = wind.Wind(self) self.running = True
def on_controls_click(self, button): loading_window = loading.Loading() while Gtk.events_pending(): Gtk.main_iteration() controls_window.show_window() loading_window.destroy()
def on_summary_click(self, button): loading_window = loading.Loading() while Gtk.events_pending(): Gtk.main_iteration() summary_window.show_window(self) loading_window.destroy()
def show_settings_window(self): loading_window = loading.Loading() while Gtk.events_pending(): Gtk.main_iteration() settings_window.show_window() loading_window.destroy()
def startGame(self): def start(): gameConfigurations = [int(self.enemiesValue.text)] playerConfigurations = [self.nickname] mapConfigurations = [self.mapSize[0], self.mapSize[1], random.randint(1000, 10000)] my.ENGINE.game = game.GameOffline(gameConfigurations, playerConfigurations, mapConfigurations) my.ENGINE.game.start() threadStarting = threading.Thread(target=start) threadStarting.start() my.ENGINE.game.hud = loading.Loading(my.ENGINE.screen) self.next = my.ENGINE.game.hud
def on_send_click(self, button): loading_window = loading.Loading() while Gtk.events_pending(): Gtk.main_iteration() try: imagename = summary.MAINDIR + 'ss/ss-' + str( datetime.datetime.now().timestamp()) + '.jpg' os.system("import -window root " + imagename) send_window.show_window() except Exception as e: message.log_error("Exception occured: " + str(e)) message.MessageDialogWindow().error_dialog( _("Error"), _("There has been an error while taking a screenshot. Please try again later" )) loading_window.destroy()
def __init__(self, language=None, reversed_btn=None): settings.MOVES_PER_SECOND = 2 reversed = False if reversed_btn is not None: reversed = reversed_btn.reversed self.game_exit = False # 0: main menu, 1: game, 2: gameover self.game_state = 0 self.prev_move = time.time() self.grid = [[False for j in range(settings.NUM_ROWS)] for i in range(settings.NUM_COLUMNS)] self.stats_collector = stats.Stats() self.language = language if language is not None: self.word_generator = words.WordGenerator(self.language, self.stats_collector, reversed) self.word, self.answer = "Temp", "Temp" self.apple_num = 3 self.apples = [] self.temp_apple = None self.temp_start = None if language is not None: self.grid[5][5] = True self.reset_apples() self.snake_obj = snake.Snake(self.word, self.grid) self.directions = [] self.game_over_screen = gameover.GameOver(self.stats_collector) self.main_menu_screen = main_menu.MainMenu() self.loading_screen = loading.Loading()