-
Notifications
You must be signed in to change notification settings - Fork 2
Pacman OO version #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
freegames/pacman_oop.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pensar em exercícios mais adequados para OO e o código atual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BrenoNAlmeida faz teu nome.
freegames/pacman_oop.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apagar e ver o que acontecer. E resolver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feito
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mas o que aconteceu quando apagou? 😅 Teve que resolver algo? Fez como?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Novas solicitações.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mais alguns pequenas correções a serem feitas.
freegames/pacman_oop.py
Outdated
def food_show(self): | ||
self.state = 'PRESENT' | ||
|
||
def food_hide(self): | ||
self.state = 'ABSENT' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apenas show e hide. food_ é desnecessário.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Algumas pequenas correções mais.
No description provided.