def enemy_shot(self): x = SoundThread("shotLaserHeight.wav") x.start() self.ui.centralwidget.close() x = EnemyLaser(self.ui.centralwidget, cause_geo=self.geometry(), bullet_width=7, bullet_height=25) # aby poprawnie dodać element do główneg widgetu należy go wyłączyć a następnie pokazać, czli zresetować self.ui.centralwidget.show()
def player_death(self): self.window.main_game = False self.make_aftergame() self.check_score() self.music.stop() x = SoundThread("shotError.wav") x.start()
def return_btn_click(self): x = SoundThread("shotClick.wav") x.start() if self.etimer.isActive(): self.etimer.stop() self.core.reload_main_menu()
def shot(self): # tworzy nowy strzał if self.can_shot: x = SoundThread("shotLaser.wav") x.start() self.ui.centralwidget.close() x = PlayerLaser(self.ui.centralwidget, cause_geo=self.geometry(), can_penetrate=self.laser_penetrate, bullet_width=self.ammo_size[0], bullet_height=self.ammo_size[1], bullet_distance=self.ammo_dist) # aby poprawnie dodać element do główneg widgetu należy go wyłączyć a następnie pokazać, czli zresetować self.ui.centralwidget.show() self.shot_accuracy_block()
def select_skin(self, path): x = SoundThread("shotClick.wav") x.start() JsonConnector.save_key_to_config("skin", path) self.centralwidget.close() self.load_skins() self.core.window.resize_tlo() self.centralwidget.show()
def can_not_buy_anim(self, btn_instance): x = SoundThread("shotError.wav") x.start() if btn_instance.text() != "Can't buy": old_txt = btn_instance.text() btn_instance.setText("Can't buy") self.etimer.timeout.connect(lambda: self.restore_btn_text( old_txt, btn_instance, self.etimer)) self.etimer.start(1500)
def one_shot(self): x = SoundThread("shotLaserEnemy.wav") x.start() self.ui.centralwidget.close() x = EnemyLaser(self.ui.centralwidget, cause_geo=self.geometry(), bullet_width=12, bullet_height=55) # aby poprawnie dodać element do główneg widgetu należy go wyłączyć a następnie pokazać, czli zresetować self.ui.centralwidget.show() self.iter_shot -= 1 if self.iter_shot == 0: self.sstimer.stop()
def select_skill(self, index_): x = SoundThread("shotClick.wav") x.start() self.skill_list[index_]["selected"] = True JsonConnector.save_skills_dict(self.skill_list) self.load_skill_to_config(self.skill_list[index_]["name"]) self.centralwidget.close() self.load_skills() self.core.window.resize_tlo() self.centralwidget.show()
def open_chest(self): x = SoundThread("shotFanfar.wav") x.start() coins = Chest().open(Postac.score) self.coin_label.setText("Coins: " + str(JsonConnector.get_from_config("coins"))) self.chest_label.setText("Award: " + str(coins) + " coins") self.start_chest_anim() self.chest_btn.setParent(None) self.chest_btn.deleteLater() self.chest_btn = None
def reload_main_game(self): self.ui.centralwidget.close() del self.ui self.ui = Ui_MainWindow() self.set_game_config(self.ui, self.window) self.ui.setupUi(self.window) self.window.resize_tlo() Postac.score = 0 self.ui.centralwidget.show() self.window.main_game = True Postac.start_enemy_clock() self.music = SoundThread("shotMainSoundtrack.wav", True) self.music.start()
def buy_skill(self, skill_dict_index, btn_instance): coins = JsonConnector.get_from_config("coins") if coins >= self.skill_list[skill_dict_index]["price"]: self.skill_list[skill_dict_index]["available"] = True JsonConnector.save_skills_dict(self.skill_list) coins -= self.skill_list[skill_dict_index]["price"] JsonConnector.save_key_to_config("coins", coins) self.make_coin_label() x = SoundThread("shotFanfar.wav") x.start() self.centralwidget.close() self.load_skills() self.core.window.resize_tlo() self.centralwidget.show() else: self.can_not_buy_anim(btn_instance)
def shop_btn_click(self): x = SoundThread("shotClick.wav") x.start() self.core.load_shop()
def skills_btn_click(self): x = SoundThread("shotClick.wav") x.start() self.core.load_skills_menu()
def play_hit_sound(): sound = SoundThread("shotLaserExplosion.wav", loop=False) sound.start()
def move_sound_start(self): if not self.playing_sound: self.playing_sound = True self.move_sound = SoundThread("shotEngineNoise.wav", loop=True) self.clocks.append(self.move_sound) self.move_sound.start()
def exit_btn_click(self): x = SoundThread("shotError.wav") x.start() self.core.stop_menu_music() sys.exit()
def menu_btn_click(self): x = SoundThread("shotClick.wav") x.start() self.core.reload_main_menu() self.core.start_menu_music()
def exit_btn_click(self): if self.chest_timer: self.chest_timer.stop() x = SoundThread("shotError.wav") x.start() sys.exit()
def start_btn_click(self): x = SoundThread("shotClick.wav") x.start() self.core.reload_main_game()
def start_menu_music(self): self.menu_music = SoundThread("shotMenuSoundtrack.wav", loop=True) self.menu_music.start()