Uh oh!
There was an error while loading. Please reload this page.
Pacman OO version - #4
Conversation
| 1. Change the board. | ||
| 2. Change the number of ghosts. | ||
| 3. Change where pacman starts. | ||
| 4. Make the ghosts faster/slower. | ||
| 5. Make the ghosts smarter. |
There was a problem hiding this comment.
Pensar em exercícios mais adequados para OO e o código atual.
There was a problem hiding this comment.
- crie um método onde verifica se o pacman se alimentou. se sim, faça as ações necessárias
- altere a forma de instancia dos fantasmas
- crie um atributo speed e faça as alterações necessárias para mudar a velocidade do pacman de acordo com seu valor
o que o senhor acha dessas 3 ?
(ps, ainda irei traduzir por inglês)
There was a problem hiding this comment.
3 eu achei OK, apesar de que talvez gere muitas dúvidas. Não sei se faria sentido fazer citar o Snake, talvez sim. Faça isso.
1 e 2 não tenho muito certeza. Olhando o código o método de 1 seria pra substituir parte de draw_score, certo? draw_score está com duas responsabilidade: verificando se comeu e desenhando os pontos. Isso me passou despercebido.
Então, talvez pudesse ser mais explícito: mova a variável/atributo de score para a classe Pacman. Essa atributo deverá ser incrementado por um novo método em pacman (eat). Altere draw_score de acordo e outras mudanças necessárias em GamePacman.
A alteração da instância dos fantasmas também não ficou clara.
Porém, a melhor forma de validar isso é resolvendo os exercícios. Então resolva-os. (Você iria fazer isso de qualquer forma, iremos colocar isso no RPP).
No meio do caminho, vai pensando em um 4o exercício. Ah, já pensei: Crie uma superclasse para Pacman e Ghost.
Talvez também valha a pena ter subclasses de Ghost. Isso substituiria fácil o exercício 2, ou seria uma forma de materializá-lo, deixando explícito.
Desafio extra: criar comidas diferentes.
ps: você pode escrever os exercícios e a gente faz o PR. Enquanto o PR é avaliado, você vai validando e a gente atualiza o ramo do PR se for necessário.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| index = self.offset(self.pacman.position) | ||
| if self.tiles[index] == 1: | ||
| self.pacman.eat() | ||
| self.tiles[index] = 2 | ||
| self.state['score'] = self.pacman.score | ||
| x = (index % 20) * 20 - 200 | ||
| y = 180 - (index // 20) * 20 | ||
| self.square(x, y) | ||
There was a problem hiding this comment.
Apagar e ver o que acontecer. E resolver.
There was a problem hiding this comment.
Mas o que aconteceu quando apagou? 😅 Teve que resolver algo? Fez como?
There was a problem hiding this comment.
quando apaguei, ele apenas parou de aparecer o score e de comer as bolinhas brancas, ai fiz as alterações que tão no commit a frente e deu certo.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
adorilson
left a comment
There was a problem hiding this comment.
Mais alguns pequenas correções a serem feitas.
| def food_show(self): | ||
| self.state = 'PRESENT' | ||
| def food_hide(self): | ||
| self.state = 'ABSENT' | ||
There was a problem hiding this comment.
apenas show e hide. food_ é desnecessário.
adorilson
left a comment
There was a problem hiding this comment.
Algumas pequenas correções mais.
No description provided.