AMOS TOME Series IV Manual  Index Prev Page Next Page 11

Another, more powerful, function used to check tiles on the map is called =Tile Val, and uses the syntax

=Tile Val(x,y,list)

and if you've read the bit about tile values earlier in this manual, you'll know that they are most excellent, and totally bodacious when it comes to finding out what you are standing on.

Tile Val works in the same way as the =Map Tile function, in that it first gets the tile number at the co-ordinate X,Y on the map. It then looks up that particular tile number in the requested list and returns the tile value (a number between 0 and 255) that is listed there for it.

Before using the tile val function, you must make sure that the tile values have been loaded in. Like the maps, they can be stored on disk in two formats, either as .Abk which is easier to load, or as .Map.Val, which saves disk space. If it is stored on disk as a .Abk file, simply do:

Load "MyTileVals.Abk",8 : Rem Bank 8 is the Tile val bank

If it is a .Map.Val file, find out the length (between 256 and 2048 bytes in size, it will always be a multiple of 256 bytes).

You now need to reserve bank 8 to this length in bytes, and Bload the file to the start of bank 8. e.g

Reserve As data 8,256
Bload "MazeMan.Map.Val",Start(8)

You can now use the =Tile Val function.

You can also change the map from within your program, using the Map Plot command, which works the same way as the normal Plot command, except that it changes a tile on the map instead of a pixel on the screen. The command uses the syntax:

Map Plot tile,x,y

and only changes the map itself, it doesn't change the screen until you re-display the map in some form. (See Map Update). Try the following:

Map Do 0,0
Map Plot 5,3,3

and you'll notice no change in the screen, but the map itself has changed. If you do

Print Map Tile(3,3)

you will see that tile number 5 is now at co-ordinate 3,3 in the map. If you now re-display the map with another Map Do 0,0 command, you will see that the tile has changed.