Beispiel #1
0
 def player_release(self, e):
     if self.moving_one:
         if colisiones(self.player_one, self.walls):
             self.trigger_initial_one.emit(
                 PositionMoveEvent(N + 150, 10, True))
             self.label_player_one.move(N + 150, 10)
             self.moving_one = False
             return
         if e.ready:
             if self.player_two is not None:
                 if self.player_two.ready:
                     self.startgame()
             else:
                 self.startgame()
         else:
             self.label_player_one.move(N + 150, 10)
         self.moving_one = False
     elif self.moving_two:
         if colisiones(self.player_two, self.walls):
             self.trigger_initial_two.emit(
                 PositionMoveEvent(N + 150, N / 2, True))
             self.label_player_two.move(N + 150, N / 2)
             self.moving_two = False
             return
         if e.ready:
             if self.player_one.ready:
                 self.startgame()
         else:
             self.label_player_two.move(N + 150, N / 2)
         self.moving_two = False
Beispiel #2
0
 def move_bomb(self, e):
     bomba_ = filter(lambda b: b.id_ == e.id_, self.bombas)
     bomb = next(bomba_)
     if colisiones(bomb, self.enemigos.values()) or \
             colisiones(bomb, self.walls):
         self.trigger_stop_bomb.emit(KickBombEvent(None, e.id_))
     elif colision(self.player_one, bomb):
         self.trigger_stop_bomb.emit(KickBombEvent(None, e.id_))
     elif self.player_two is not None:
         if colision(self.player_two, bomb):
             self.trigger_stop_bomb.emit(KickBombEvent(None, e.id_))
     self.trigger_move_label_bomb.emit(e.id_)
Beispiel #3
0
 def move_enemy(self, e):
     enemigo = self.enemigos[e.id_]
     if colisiones(enemigo, self.walls) or colisiones(enemigo, self.bombas):
         self.trigger_enemy_back.emit(MoveEnemyEvent(e.x, e.y, e.id_))
     elif colision(enemigo, self.player_one):
         self.trigger_enemy_back.emit(MoveEnemyEvent(e.x, e.y, e.id_))
         self.trigger_dano_enemigo_1.emit()
     elif self.player_two is not None:
         if colision(enemigo, self.player_two):
             self.trigger_enemy_back.emit(MoveEnemyEvent(e.x, e.y, e.id_))
             self.trigger_dano_enemigo_2.emit()
         else:
             self.trigger_enemy_label_move.emit(MoveEnemyEvent(
                 e.x, e.y, e.id_))
     else:
         self.trigger_enemy_label_move.emit(MoveEnemyEvent(
             e.x, e.y, e.id_))
Beispiel #4
0
 def move_player_two(self, e):
     if self.started:
         if colisiones(self.player_two, self.walls):
             x = self.label_player_two.x()
             y = self.label_player_two.y()
             self.trigger_initial_two.emit((PositionMoveEvent(x, y)))
             return
         elif colisiones(self.player_two, self.enemigos.values()):
             x = self.label_player_two.x()
             y = self.label_player_two.y()
             self.trigger_initial_two.emit((PositionMoveEvent(x, y)))
             self.trigger_dano_enemigo_2.emit()
             return
         bomba = kick_bomb(self.player_two, self.bombas)
         if bomba:
             way, id_ = move_way(self.player_two, bomba)
             self.trigger_kick_bomb.emit(KickBombEvent(way, id_))
         power = specific_colision(self.player_two, self.power_ups)
         if power:
             self.trigger_power_two.emit(PowerUpEvent(power))
             power.catched()
         self.label_player_two.move(e.x, e.y)