This blog post is brought to you by Karen Cheng a Program Manager on the Excel team. In today's post, we'll show you how the classic arcade game Missile Command was created in an Excel spreadsheet. We also explain how it's made in this video. In this game, missiles drop from the sky, attacking the city. You must click on the missiles to destroy them.To play, you'll need - · To download the game (here) · To install Excel 2010, hot off the press last week. You can get a free trial here. The games use features that are new to Excel 2010, so they won't work in older versions.When you open the file to play, don't forget to enable the macros.The Graphics EngineThe "graphics engine" is made entirely with conditional formatting. Each cell, which represents a pixel, has a number in between 1-10 to represent a shade of grey.You can't actually see the numbers because the cells have been shrunken down, but enlarge the cells a bit and you'll see the numbers behind the "pixels":The numbers behind the graphics engineThe entire game runs from a macro that is triggered by clicking on Start. The macro constantly recalculates what numbers to populate the grid with.Calculating Missile PathsEach missile runs through this series of calculations:1. The starting point for the missile is chosen to be somewhere at random at the top of the screen2. Each missile will at random choose one of the remaining standing buildings to target. It chooses one cell in the general perimeter of the building3. Based on the starting and ending cell, the slope of the path the missile is calculated, such that it travels at the correct X to Y (column to row) ratio4. The macro then repopulates the cells in the path over and over again in a loop to "draw" the missile path5. If the missile hits the building,
Windows 7 32 Bit, the game notes which building has been destroyed. The cells around the building are redrawn to the "destroyed building" state and the missile is removed.Destroying the MissilesMissiles are destroyed by clicking and creating a shield,
Microsoft Office 2007 Product Key, which looks like an explosion effect. If the shield and missile collide, the missile is destroyed.1. To detect the gamer's click, the macro detects when the cell selection changes. If the new cell selection is within the playable game area, the shield is drawn.2. To draw the shield, the macro quickly draws and redraws six frames in sequence The shield explosion effect,
Office Professional Plus, frame by frame.3. If any part of the shield and missile occupy the same cell,
Microsoft Office 2007, the missile's path is aborted and the missile is destroyed. If any part of the shield occupies a cell occupied by a standing building, that building is destroyed. General GameplayWhen a missile is destroyed, another one is instantly created. The number of missiles on the screen at any given time corresponds to the level. So at level 5,
Windows 7 Home Premium Key, there will be 5 missiles on the screen at once.The progress bar indicating how far the gamer is along a level is value in a cell formatted by a data bar. The level progress indicatorFormatted by data barsOne more thing - you can peek behind the code (and hack away to your heart's desire) by pressing Alt-F8 and clicking edit.The code behind the scenesThanks for tuning into this episode of How It's Made. In the next edition, we'll show you how the classic arcade game Tower Defense is made in Excel. <div