Packman game

Hi Bubbachunk,

I got the images you intend to use.

If you recall I suggested that you start your program by finding out how big the window is, and setting the units to pixels.

If you check your pictures you will find the dimensions are 311x585 for the instructions, and 2070x2694 for the game map. You might be able to display the first image on most screens, but very few screens can handle the second bigger image. I would suggest you reduce the image size to less than 800x600 pixels - that way it will fit most screens.

You (and many others) need to know something about image formats. Your images are in JPG format which is fine for photos because photo images have fuzzy edges anyway. The file size of JPG images is also very small. However, JPG is only an approximation, so the image quality declines each time you save it - lines get fuzzier and blocks of color are far from pure. In your game you will need to check the color of the walls and you won't be able to do this with JPG colors which are a mixture of colors that give the impression of a uniform single color. You need to use BMP format because the colors stay true regardless of how often you modify the picture. The file size of BMP images is much larger - but who cares. Your immediate task is to re-size your images and save them in BMP format. Don't try to resize your JPG images and then save that, because the colors in the JPG images are already impure. Re-draw your map using backgrounds and walls in single colors - you can always tell pure colors because the flood color "bucket" works properly in PAINT.

Big John


pac-man game

I am currently redoing my pictures in bitmap and i will send them to you when i am finished. also i do not know how to import bmp images.



What is the objective of the game?

Is it to get Pac-man out of the maze without being caught by the ghosts?
Or is it to collect a number of tokens before being caught?

Do the ghosts start off in a reserved area at the center of the maze or do they suddenly appear?

I would suggest that you create a grid 600x400 pixels in size because this will fit most screens. I would suggest you mark out 30x30 pixel squares and put a yellow dot in the center. This will be the basis of your maze. Now you can start drawing walls.

If we allow 5 pixels for the walls then this leaves you with 25x25 pixel blocks for the pacman image and the same sized block for the ghosts (and the tokens if you use them). Essentially you will have a grid made of 20 blocks across and 15 blocks down the screen. This way it will be much easier to locate pacman and the ghosts by their block number.

Big John

I have received your files

First, I was wondering if the following was all I needed to import a bitmap image...
CALL read_image ("MS BMP",filename$, "filename.bmp")

Second, I have a question about the map that you made. When pac-man actually goes over the coins they are supposed to dissappear, am I going to have to make thousands of maps with all the combinations of the order in which the coins are collected, Or can I make it plot a flooded box over the coins that are collected, or how would I go about doing that?

Third, Inserting pac-man into the game. I've been thinking about this, and I don't know exactly how to do this. I was thinking mabey assigning each grid square a number and making a random number statement or something and then what ever number my RNS makes will be the grid that pac-man is CALL read_image ("MS BMP",pacman$, "pacman.bmp") to. Do you think that doing this would work?

Fourth, I wanted all four of the ghosts to start out in the middle box. but since they to as well as pac-man cannot go through green because that is a wall Should i make a different colored line the length of a grid on the middle box, Or would they all have to use their own random number statements to be placed into the game?

Pac-man game


The secret to good programming is to make as much of your code 'general purpose' i.e. try to write a block of code that can be used many times over just by changing the values of the variables. For example, you could write a piece of code that draws a simple table 5'x3'x4'high, or you could write the code that will draw a table lengthxwidthxheight, which will draw a table of any size. The same goes for pacman.

The routine that moves pacman can also be used for moving ghosts. In that same routine we can test for spots on the pathways - if there is no spot then it must be treasure (or a coin). When pacman moves off a treasure square he must leave behind a spot in place of the treasure. Just one routine will cope with any map. You don't have to write thousands of routines to cope with different maps.

You are right to think of the map as a series of numbered squares. A simple random number routine will initially place pacman on the map (but check that it has a spot first - otherwise it isn't a pathway).

The ghosts start in the center box. When you are ready to release them you just jump them to an adjacent square that has a spot - i.e. put them onto a pathway. Do you intend releasing them on a timed basis or all at once? You could create an opening in their box and let them try to work their way out on their own. This could be interesting because driven by random numbers one or more ghosts may not make it out of the box - gives the player a bigger chance.

Give me an hour or two and will start you off on the code to move pacman and to collect treasure. Then you can see how it is done.

Big John


~dear BIG JOHN~
I have just redrawn the level 1 map I have e-mailed you a zipped folder it includes the 30x30 pixel grid of 600x390, it also includes the map outline and the completed (colored in map), and a version of the pac-man character I would like to try to use. I have not created the ghosts yet.


I was planning on making the pac-man collect the coins like in the real version. I will start on the new level with the specific pixels right now, and send them to you when i'm finnished.


This would explain why my pictures were always going fuzzy whenever i saved them thanks Big J