Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def add_item(self, click_position):
- """
- Event handler to add new obstacles, humans and zombies
- """
- row, col = self._simulation.get_index(click_position, CELL_SIZE)
- if self._item_type == OBSTACLE:
- if not self.is_occupied(row, col):
- self._simulation.set_full(row, col)
- elif self._item_type == ZOMBIE:
- if self._simulation.is_empty(row, col):
- self._simulation.add_zombie(row, col)
- elif self._item_type == HUMAN:
- if self._simulation.is_empty(row, col):
- self._simulation.add_human(row, col)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement