One of those Auto maps
You will notice within the flash file that there are two movie clips related to the creation of the auto map display. The AutomapTile is simply a set of tiles for the map. This is actually what is used for displaying the pieces of the map. The actual movie clip/class that displays the map is the Automap Page movie. It is fairly simple.
- initAutomap();
- stop();
- function initAutomap()
- {
- if (automapInitialized != undefined)
- automapInitialized = true;
- var newTile;
- var tempID;
- automapTilemap = new Array();
- for (var cntrY = 0; cntrY < 32; ++cntrY)
- for (var cntrX = 0; cntrX < 32; ++cntrX)
- {
- tempID = automapTilemap.length;
- newTile = attachMovie("AutomapTile", "t"+tempID, automapTilemap.length);
- newTile._x = cntrX * 12;
- newTile._y = cntrY * 12;
- newTile.gotoAndStop(1);
- automapTilemap.push(newTile);
- }
- location_movie = attachMovie("LocationMarker", "lm", 1025);
- }
- function updateAutomap(ootw18)
- {
- trace ("Updating automap");
- var id = 0;
- for (var cntrY:Number = 0; cntrY < 32; ++cntrY)
- for (var cntrX:Number = 0; cntrX < 32; ++cntrX) {
- automapTilemap[id].gotoAndStop(ootw18.automapData[cntrY][cntrX]+1);
- ++id;
- }
- location_movie._x = ootw18.playerX * 12;
- location_movie._y = ootw18.playerY * 12;
- }
You will notice that this code makes use of the global ootw18 class which holds the map and auto map data. Within this class, whenever the player moves a chunk of the auto map is marked as visible. This is fairly simple code.
- for (var cntrX:Number = -3; cntrX < 4; ++cntrX) {
- tx = nx+cntrX;
- if (tx < 0) continue;
- if (tx > 31) break;
- for (var cntrY:Number = -3; cntrY < 4; ++cntrY) {
- ty = (ny+cntrY);
- if (ty < 0) continue;
- if (ty > 31) break;
- tchar = tdTilemap[ty].charAt(tx);
- tempTile = TILESET.indexOf(tchar);
- automapData[ny+cntrY][nx+cntrX] = tempTile + 1; // remember 0 is used for unseen tile
- }
And that is all that is needed to create an auto map, at least if you are using a simple tile structure for your map data.