# Do nothing on null moves
if not self.player.move(direction, self.level_obj):
return
- self.check_state()
+ if self.check_state():
+ return
self.do_nemesis_move()
def do_nemesis_move(self):
self.nemesis.move(self.level_obj, self.player.pos)
- self.check_state()
+ if self.check_state():
+ return
if self.move_counter > 4:
self.move_counter = 0
self.draw_nemesis()
self.nemesis.move(self.level_obj, self.player.pos)
- self.check_state()
+ if self.check_state():
+ return
else:
self.move_counter += 1
self.draw_nemesis()
def check_state(self):
if not self.level_obj:
- return
+ return True
if self.level_obj.at_exit(self.player.pos):
self.reset_level()
# Jump to next level
if not self.load_level():
self._closed()
self.app.game_over(True)
- return
+ return True
elif self.check_caught():
# Caught
if self.app.config.getdefault('bane', 'sound', '0') != '0':
self.reset_level()
self._closed()
self.app.game_over(False)
- return
+ return True
elif self.level_obj.is_button(self.player.pos):
self.level_obj.trigger_button(self.player.pos)
elif self.level_obj.is_button(self.nemesis.pos):
for map_pos, new_tile in self.level_obj.get_changed_tiles():
pos = (map_pos[0] * TILE_SIZE, map_pos[1] * TILE_SIZE)
self.draw_tile(pos, new_tile)
+ return False
def _calc_mouse_pos(self, pos):
pos = self.to_local(*pos)