Yeah, I thought that. Firstly you need to get the tile location, like the tile number where your checking collision on - then use a sorta mask array which is the same size as a tile.
Say your map array was called MAP, and you had a 2D array with 1's and 0's for the mask of each tile called MASK - it has to be the same size. Assuming a tile size of 32x32 and an 11x11 map, you'd do this to check a specific point:
` Map array
DIM MAP(11,11)
` Ten different masks
DIM MASK(10,32,32)
do
if col(mousex(),mousey())=1 then text 0,0,"Col"
sync
loop
`Collision function
Function Col(x,y)
xx=x/32
yy=y/32
col=0
if xx>-1 and xx<11 and yy>-1 and yy<11
tile=map(xx,yy)
mx=x-(xx*32)
my=y-(yy*32)
if MASK(tile,mx,my)=1 then col=1
endif
Endfunction col
Now that's not designed as a copy and paste style demo, it's to give you the basic principles, you'll have to work on it.
To get the mask data into the array, you can just paste your image onto a bitmap and use the point command, anything but 0 should be set to 1. If you want to check collisions with another mask, like if you had a mask for your character too, you'd step through each pixel on the mask and check it's location - this can easily be done with offsets on the original collision location, however it will be a lot slower. Remember to exit the loop when finding a collision if you do this to speed things up.
There is another option that is too complex to go into here in detail, just watch for the Jetpac2003 source next month, it uses a weird sorta wave collision. Like the object would be cut into vertical slices, and the 2 heights are stored, so a platform would be easy to make a slice collision mask for, but really complex objects need to be split up. It looks sorta like a low res sound waveform. Because it's only checking 2 heights for each segment along the X axis, it's much faster than checking every point. All my slice collision needs to do is step through each nearby platform and check to see if there's any overlap. I won't pretend the code is easy, but there is a program for making the slice maps easily (and automatically would you believe) - and if I can, I'll make a simple demo of using the system. It could well be among the very fastest 2D collision methods. Note that Jetpac has been debugged more, and the collision is much smoother now than the released version.
Van-B
My cats breath smells of cat food.