Jump to content

  • Log In with Google      Sign In   
  • Create Account


Like
0Likes
Dislike

Making Games with Excel

By Super Llama | Published Jan 25 2008 08:44 AM in Game Programming

cell maze cells sample code first excel button file
If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource

You might be thinking: "Excel? Games? Impossible!"

The strange answer is this: Excel CAN make games. As far as I know, I am one of the first people to try to do such a thing, and it is surprisingly fun.

Ever since I discovered that you can use cell borders to make mazes, I fell in love with Excel and it's VB-based macro system. Now, I have created something you might like: a Maze Template for Excel (included XLS sample file)

It's not just a visual maze, it's a full-fledged GAME. First, open my XLS file. It includes all the actual code necessary, and a sample maze.

Now, use the Cell Border system to draw a maze and shade all the cells grey. Make sure the cells all use the Wingdings font in size 20 (this is necessary to display your character)

Now every cell that is NOT in the maze should have a solid white fillcolor (to hide the gridlines) and a solid white font color (to hide the codes). Do this now.

Next you have to make a place for the player to start. The first two cells contain this information. Cell A1 contains the Column number (not letter) of the start cell, and Cell B1 contains the row number. Shade this cell yellow and put a J in it. This will become a Smiley-face (if you used Wingdings like you were supposed to)

Now, before you finish, you need to add a finish cell. Shade this green, and make the text color green. Place an F in the finish cell. An alternative is to keep the text color black and place an F in an adjacent cell (one outside the maze). This is the technique used in the sample.

Now, if you want, you can add Teleporters to make it more interesting. Teleporter cells have either an R or a C in them, determining where to find the destination. If you put an R in the cell, the program looks to the first two cells in the same row as the teleporter for the destination. They are in the same format as the start location; two numbers indicating the location of the cell. If there is a C in the cell, the code looks for the destination location in the first two cells of the teleporter's column.

Another optional feature is lava or other hazards. To create a hazard, simply click the Bold button. All bold cells are considered hazards, and they will kill Mr. Smiley and make him say Ouch (hehe)

Once your maze is finished, click the Play button (the green > on black) and it will change to a pause button. You can move your character around with the arrow keys. When you're done, or you want to make changes to the maze, just click the pause button ( l l ) to stop playing and unlock the maze. Don't type anthing while the game is playing though! It transforms Mr. smiley into a strange symbol until you move again...

Eventually I will add more advanced things like:

  • Keys and Doors
  • Monsters and Weapons
Keep your eye out for the Excel Maze API version 2!

Look to the sample file for all the illustration you need.

NOTE: In order to use the macro code from the sample file, you can either re-save the sample and change the maze around, or you can go to Tools -> Macro -> Visual Basic Editor, and copy the code for Sheet1 into your own XLS file. But remember, give me credit for the orginal code!

Have fun makin' mazes! :)






Comments

Note: Please offer only positive, constructive comments - we are looking to promote a positive atmosphere where collaboration is valued above all else.




PARTNERS