so yeah. i was thinking a bunch about this and didn't get to put it in here yet. lots of stuff getting in the way of this project. anyways.
so i figure the best way to do this project (as opposed to how i've gone about things in the past) is to leave the drawing until last. i know that i won't be able to debug the program if i don't have a way to see it, so i'll append "won't do any serious drawing" until the end. i want to leave the game open to add different methods of drawing, so i can easily add in a dx or ogl interface if i want to.
that being said, every tile in the map is going to have dimensions 1.0 x 1.0. i should probably explain the tiles themselves. as far as i can understand it, each wall tile has its line running through the middle of the tile. this allows the pacman and ghosts to take up 2x the space than they actually use. each corridor is only 1 tile in width, which means it would be easiest to make the pacman and ghosts' tile-clipping rectangle only 1 tile in size as well.
when the pacman's clip rect lines up with a dot tile (or passes over the line-up state of a dot), he eats it. moving the pac around isn't hard, when you line up or pass a tile, you stop at that tile and see if you can continue in that direction from that tile. if you can't, you're stopped on that tile. if you've pressed a direction (whether released or not) and you align to a tile, you check if you can go in that direction and go that way if you can. if you choose the opposite direction, you immediately turn around.
ghosts follow the same rules, sans opposite direction. the ai should generally check to see if its at an intersection before deciding on a new direction. each of the four ghosts has a different way to decide on a new direction. each also has a speed slightly greater than or less than the pacman. pacman and ghost collision should tested with a different rectangle than their map clipping rect. these rects are probably 3/4 the size of the pac and ghost sprites, which would be 1.5x the size of a tile.
when the pacman clip rect lines up with a power pill, the ghosts turn blue (scare state) and immediately do a pathfind to get away from pac. at every intersection, they'll do it again. this will last for a period of maybe 10seconds. when the power pill effect is over, they return to their original colors and resume their regular pathfinding.
during the powerpill effect, if the pac touches a ghost during scare state, the ghost is 'eaten' and changes to eyes. the ghost will return to the spawn box and will be returned to normal state for the duration of the powerpill effect. near the end of the powerpill effect, any ghosts still in scare state will blink until the effect is over.
i need to find out how they do the ai for each of the ghosts. i'm sure one of the ghosts is completely random, and one of them finds the shortest route to pac.. [researching] http://www.everything2.com/index.pl?node_id=499157 is the answer. [reading] oh crap. this thing is going to be more complicated than i originally thought. thats ok, i'll nail it.
order of programming:
- pacman on maze
- pellets on maze
- ghosts on maze
- power pellets