コード例 #1
0
 def _random_attack(self):
     attack = self._key_bindings[random.choice(attacks)]
     self._memory.append(attack)
     keys.press_key(attack)
     time.sleep(0.05)
     keys.release_key(attack)
     time.sleep(0.05)
コード例 #2
0
 def _random_move(self):
     move = self._key_bindings[random.choice(moves)]
     self._memory.append(move)
     keys.press_key(move)
     time.sleep(0.05)
     keys.release_key(move)
     time.sleep(0.05)
コード例 #3
0
 def press_moves_concurrent(self, moves, sleep_time):
     for move in moves:
         keys.press_key(self._key_bindings[move])
     time.sleep(sleep_time)
     for move in moves:
         keys.release_key(self._key_bindings[move])
     return moves, 'concurrent'
コード例 #4
0
 def _attack(self):
     if self._current_action == 'defence':
         self._stop_defence()
     keys.release_key(self._key_bindings['HIGH_PUNCH'])
     time.sleep(0.05)
     keys.press_key(self._key_bindings['HIGH_PUNCH'])
     keys.press_key(self._key_bindings['RIGHT'])
     self._current_action = 'attack'
コード例 #5
0
 def _random_good_move(self):
     if not self._good_moves:
         return
     seq = random.choice(self._good_moves)
     for action in seq:
         self._memory.append(action)
         keys.press_key(action)
         time.sleep(0.05)
         keys.release_key(action)
         time.sleep(0.05)
コード例 #6
0
 def _defence(self):
     keys.press_key(self._key_bindings['LEFT'])
     time.sleep(0.05)
     keys.release_key(self._key_bindings['LEFT'])
     time.sleep(0.05)
     keys.press_key(self._key_bindings['LEFT'])
     time.sleep(0.05)
     keys.release_key(self._key_bindings['LEFT'])
     time.sleep(0.05)
     keys.release_key(self._key_bindings['HIGH_KICK'])
     time.sleep(0.05)
     keys.press_key(self._key_bindings['HIGH_KICK'])
     self._current_action = 'defence'
コード例 #7
0
 def _attack(self):
     keys.press_key(self._key_bindings['RIGHT'])
     time.sleep(0.05)
     keys.release_key(self._key_bindings['RIGHT'])
     time.sleep(0.05)
     keys.press_key(self._key_bindings['RIGHT'])
     time.sleep(0.05)
     keys.release_key(self._key_bindings['RIGHT'])
     time.sleep(0.05)
     keys.release_key(self._key_bindings['HIGH_KICK'])
     time.sleep(0.05)
     keys.press_key(self._key_bindings['HIGH_KICK'])
     self._current_action = 'attack'
コード例 #8
0
ファイル: menu_control.py プロジェクト: PolyakovD/pymkbot
 def move(self, direction):
     press_key(self._keybindings[direction])
     time.sleep(0.05)
     release_key(self._keybindings[direction])
     time.sleep(0.05)
コード例 #9
0
ファイル: menu_control.py プロジェクト: PolyakovD/pymkbot
 def start(self):
     press_key(self._keybindings['START'])
     time.sleep(0.05)
     release_key(self._keybindings['START'])
     time.sleep(0.05)
コード例 #10
0
ファイル: menu_control.py プロジェクト: PolyakovD/pymkbot
 def select(self):
     press_key(self._keybindings['BLOCK'])
     time.sleep(0.05)
     release_key(self._keybindings['BLOCK'])
     time.sleep(0.05)
コード例 #11
0
 def _random_movement(self):
     movement = self._key_bindings[random.choice(['LEFT', 'RIGHT'])]
     self._memory.append(movement)
     keys.press_key(movement)
     time.sleep(0.25)
コード例 #12
0
 def _defence(self):
     if self._current_action == 'attack':
         self._stop_attack()
     keys.press_key(self._key_bindings['LEFT'])
     keys.press_key(self._key_bindings['UP'])
     self._current_action = 'defence'
コード例 #13
0
 def press_moves_sequence(self, moves, sleep_time):
     for move in moves:
         keys.press_key(self._key_bindings[move])
         time.sleep(sleep_time)
         keys.release_key(self._key_bindings[move])
     return moves, 'sequence'