13 levels have been implemented and the game moves to the next level once all pellets have been eaten.
Sunday, November 15, 2009
Pellets
Saturday, November 14, 2009
Improving Maneuverability
I realized that making pacman change direction into a new tunnel was very hard since the key had to be pressed at the exact pixel to avoid collision. This would have led to frustrating gameplay. The solution was to keep track of the arrow key that was pressed last - the game knows where the player would like to go and checks at each step if the move can be made. Making turns is now much easier.
Resize Screen/Apply Background
Legal Ghosts
Continuous Motion
After adding the ghosts, I worked on implementing continuous motion - not step by step. The ghosts and pacman all move smoothly now, but only pacman checks for collisions - the ghosts can still go through walls and through each other.
Added Ghosts
Added ghosts today. At the moment they do not move - I am yet to implement continuous motion.
Sunday, October 25, 2009
Moving Within Maps
Drawing Maps
I learnt about how to read from a text file and paste 'tiles' at the correct positions on the screen so that I can represent maps. For now, I am not going to worry about legal movements or collisions - the walls only appear on screen; the monkey can still go over them.
Basic Pygame
I've been reading Python and Pygame code over the last few days and now feel comfortable experimenting.
I made a simple game where you can move a monkey across the screen by using the arrow keys on your keyboard. I used the world map as a background and added wrap-around functionality. Very basic stuff.
Saturday, October 10, 2009
Representing Maps
I'm considering how best to represent and store maps. At the moment, a simple text file with distinct rows and columns seems to be the obvious choice. Each 'element' in the text file will be an integer that represents a 'tile' in the game. Every tile must either be 'wall' or 'tunnel', where the latter can hold pacman, ghost, fruit etc.
To be updated.
Ghost Algorithm
The original pacman seems to have had a fairly simple algorithm for ghost movements - at each intersection, they simply choose the direction that takes them closer to pacman in an absolute sense. Some modern games seem to use more sophisticated algorithms like the A* etc.
To begin with, I think I'm going to stick to tradition and use the simple logic, mixed with randomness. Lower difficulty levels will have a higher proportion of random decisions. I may work on a more sophisticated algorithm later on.
Sunday, October 4, 2009
Installing Python and Pygame
It seems there isn't much support for Snow Leopard yet so installing the packages hasn't been easy. I'm currently trying to do it with fink, lets see how it goes.
Python 2.6.3 for Mac from http://python.org/download/
Pygame-1.9.1 from http://www.pygame.org/download.shtml
Update: Nope, nothing worked on OSX 10.6. I had to switch down to Leopard and install the following:
Python 2.6.3 for Mac from http://python.org/download/
Pygame-1.9.1 from http://www.pygame.org/download.shtml
Update: I just upgraded to Snow Leopard once again (the installer moved everything automatically) and both Python and Pygame still work. I guess compatibility is no longer an issue.
Subscribe to:
Posts (Atom)