Keeping track of the images and their locations in the chart is critical if the game is going to work properly. Keep in mind that the chart's images are actually data markers; it is natural to think of deleting or changing the data values to simulate image swaps or deletions. You could probably even design the program to function by altering the charted values, but that seems too complicated. Since the bubble chart will constantly have to display 100 images in a 10 by 10 grid, it will be a lot easier if the data remains static and all the program changes are the images contained in the data markers.
There are a number of methods you could use to track the chart's images including the use of a multi-dimensional array that is updated with each alteration of a data marker on the chart. This also seems like a lot of extra work when I can use a worksheet range to map each image type and its location in the chart. For example, consider the images shown in Figure 9.14 and their associated file names.
The images of the aliens and their associated file names used in the Alienated Game.
I purposely used integers in each file name to identify the specific alien. To add images to the chart, the program must first create a 10 by 10 map of integers between 1 and 7 in a worksheet range consisting of 10 rows and 10 columns as shown in Figure 9.15. The values in this range (hereafter referred to as the image map) correspond directly to the integer values in the file names of the alien images.
The chart's data markers are then loaded using the values from the image map contained in the ImageMap worksheet. Generating the integers randomly ensures that the image markers are filled randomly with one of the seven images shown in Figure 9.14. The chart sheet created from the image map shown in Figure 9.15 is shown in Figure 9.16.
Since the image map identifies each image in the chart, any change to the images required during the course of a game must be mirrored in the image map. In fact, it will be easiest to first update the image map and use it to update the images displayed in the chart.
The sample map of image identifiers used by the Alienated Game to track image markers in the chart sheet interface.
The chart sheet with data markers filled with images using the integer map shown in Figure 9.15.
E2 Microsoft Excel - Alienated,xls
Vl File Edit ■>v. insert Format loot chart window Help néa sá * «s e- - e ^ - 2; í;
* « o V > m • • ft . ô . Ä À • 9 ® ^ $
I • f 80 ft i m' m tó 80 "« .. gsftft»n»aa¡«ft
Was this article helpful?