trash.go 441 B

12345678910111213141516171819202122232425
  1. package robots
  2. func (game *Game) drawTrash() {
  3. for _, t := range game.trash {
  4. game.screen.SetContent(t.x, t.y, '*', nil, game.style)
  5. }
  6. }
  7. func (game *Game) onTrash(pos Position) bool {
  8. var found bool
  9. for _, t := range game.trash {
  10. if t == pos {
  11. found = true
  12. }
  13. }
  14. return found
  15. }
  16. func (game *Game) addTrash(robot Robot) {
  17. game.trash = append(game.trash, robot.position)
  18. }
  19. func (game *Game) cleanTrash() {
  20. game.trash = nil
  21. }