catidiana / pacman

Reacreation of Pac-Man classic game
GNU General Public License v3.0
2 stars 4 forks source link

Update main.cpp #3

Closed simhj316 closed 4 years ago

simhj316 commented 5 years ago

The pacman_stay in pacman.cpp is only declared and not initialized. An error occurred when moving to the next level and deleted.

simhj316 commented 4 years ago

Modified to give pacman a change when eating an energizer

kkamankun commented 4 years ago

hellpacman

hellpacman.png

simhj316 commented 4 years ago

Sorry, are you referring to the count in ghost.cpp? It represents being a hellpacman under the conditions of ghosts. So it's hard to erase.

mampir commented 4 years ago

You mean, it's used to check if there are any frightened ghosts, so we know when to draw hell or normal Pacman. The variable "count" is badly named, because it's not clear what it counts and in reality it doesn't count anything, because it's either 0 or 1 (FRIGHTENED or NOT FRIGHTENED). You don't need a separate variable for that, you can just use ghost.state == GHOST_FRIGHTENED.

Also, the way you declared "count", placed between 2 functions, and indented as if it's inside a function, isn't very nice. You should have put it right after "public:", similar to how it's done in the ghost class. And since every ghost has a "count", you should have put it in the ghost class instead, and not in 4 places.

I also checked the image, and it has graphical artifacts (white dots around it), which is very sloppy job...

I merged and fixed all that.

kkamankun commented 4 years ago

Thank you for your devotion. This experience has given me a good study of cooperation.

mampir commented 4 years ago

Happy to help. Would like to see more stuff from you. :)