Ok enough with the monkey, I'll now use actual Pacman icons. I figured out how to move a 'ghost' within the map such that it is confined within the walls. For now, I'm still using turn by turn movement - as in pressing left once moves the ghost left by one step.
Sunday, October 25, 2009
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)