Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. def add_item(self, click_position):
  2. """
  3. Event handler to add new obstacles, humans and zombies
  4. """
  5. row, col = self._simulation.get_index(click_position, CELL_SIZE)
  6. if self._item_type == OBSTACLE:
  7. if not self.is_occupied(row, col):
  8. self._simulation.set_full(row, col)
  9. elif self._item_type == ZOMBIE:
  10. if self._simulation.is_empty(row, col):
  11. self._simulation.add_zombie(row, col)
  12. elif self._item_type == HUMAN:
  13. if self._simulation.is_empty(row, col):
  14. self._simulation.add_human(row, col)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement