We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone, we are a group of students who are working on processing to try to do a pacman game (it's a school project). As the original one, we were thinking about setting up a labyrinth, with a pacman and ghosts inside. However, we have some problems when trying to do the program in processing:
-How could we manage to make the pacman going through the labyrinth (white path) without getting a out of it (black stroke). I mean, the path would be colored in white, while the walls would be colored in black.
-How could we manage to know the ubication of a pixel ?(is there a processing fonction/reference that allows us to know it?)
We would be gratefull if you could help us.
Answers
hello there ^_^
you should take a loke at this: http://www.openprocessing.org/search/?q=pacman
see if any of this helps
There's a number of ways you can do it, guys. It also depends on how you want to create the labyrinth itself. If you use a plain image, have a look at pixels[] you can get the color of each pixel with this array and determine weather pacman can go there.
This is not very effective, however. As far as I could remember pacman is a grid-like game. You can create a grid and make some cells accessible and some not. You can also have other properties for each cell, for example if it contains food. You will be also able to easily save game progress or create more maps easily with this approach (using XML, for example). Good luck.
http://studio.ProcessingTogether.com/sp/pad/export/ro.9Ql2E8JBC54LJ
the grid idea is the best. in fact this page has the grid for the original
http://pacman.shaunew.com/play/mapgen/
specifically
http://pacman.shaunew.com/play/mapgen/img/origmaps_2x_print.png
you can see that that easily translates to a 2d array of integers containing walls, dots, power pills, empty squares...
https://forum.processing.org/two/discussion/11156/pac-man-game-not-completed-asking-for-assistance