Skip to content

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Pacman OO version #4

wants to merge 13 commits into from

Conversation

BrenoNAlmeida
Copy link

No description provided.

Comment on lines 5 to 9
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.
Copy link
Member

@adorilson adorilson Mar 17, 2021

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. crie um método onde verifica se o pacman se alimentou. se sim, faça as ações necessárias
  2. altere a forma de instancia dos fantasmas
  3. 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)

Copy link
Member

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.

Copy link
Member

@adorilson adorilson left a 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.

Comment on lines 239 to 247
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)

Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feito

Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

@adorilson adorilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Novas solicitações.

Copy link
Member

@adorilson adorilson left a 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.

Comment on lines 104 to 109
def food_show(self):
self.state = 'PRESENT'

def food_hide(self):
self.state = 'ABSENT'

Copy link
Member

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.

Copy link
Member

@adorilson adorilson left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants