コード例 #1
0
ファイル: main.py プロジェクト: khoa1999/DSA_project
 def _special_condition(self):
     self.has_data = False
     self.tick += 1
     if(self.tick == 70):
         if(self.choice == 0):
             self.effect.set_location(self.location)
         else:
              self.effect.set_location(self.location)
              self.effect.set_location((self.location[0] - 1,self.location[1]))
              self.effect.set_location((self.location[0] + 1,self.location[1]))
              self.effect.set_location((self.location[0],self.location[1] + 1))
              self.effect.set_location((self.location[0],self.location[1] - 1))                 
         return False
     elif(self.tick < 50 and self.choice == 0):
         a = Hu.weapons[self.choice]
         a.x += self.actual_location[0]//48
         a.y = (self.actual_location[1]/(self.actual_location[0])**2)*(a.x)**2
         a.reset()
         a.rotate(-90*np.arctan(2*(self.actual_location[1]/(self.actual_location[0])**2)*a.x)/(np.pi/2))
         return False
     elif(self.tick > 120):
         self.tick = 0
         a = Hu.weapons[self.choice]
         a.reset()
         a.x = 0
         a.y = 0
         self.effect.reset()
         if(Backend.check_win()[0]):
             self._next = Hu.states["Winner"]
         else:
             Hu.info_board.set_text("AI turn")
             y,x = Backend.computer_hit_at()
             Hu.states["Computer"].set_location_fire([x,y])
             self._next = Hu.states["Computer"]
         return True
     elif(self.tick == 1 and self.choice == 1):
         a = Hu.weapons[self.choice]
         a.rotate(
                 -90*np.arctan(self.actual_location[1]/
                              self.actual_location[0])/np.pi)
     elif(self.tick < 50 and self.choice == 1):
         a = Hu.weapons[self.choice]
         a.x += self.actual_location[0]//48
         a.y += self.actual_location[1]//48
コード例 #2
0
ファイル: main.py プロジェクト: khoa1999/DSA_project
 def _special_condition(self):
     if(not self.paused):
         self.tick += 1
     a = Hu.weapons[0]
     if(Backend.check_win()[1]):
         self._next = Hu.states["Loser"]
     else:
         self._next = Hu.states["Player"]
     if(self.tick < 50 and not self.paused):
         self.player_board.reset_draw_last_hit()
         a.x += self.actual_location[0]//48
         a.y = (self.actual_location[1]/(self.actual_location[0])**2)*(a.x)**2
         a.reset()
         a.rotate(-90*np.arctan(2*(self.actual_location[1]/(self.actual_location[0])**2)*a.x)/(np.pi/2))
         return False
     elif(self.tick > 90):
         a.reset()
         a.x = 0
         a.y = 0
         self.tick = 0
         return True
     elif(self.tick == 50):
         self.player_board.set_draw_last_hit()