Terry,
I think I know what might be going wrong for you.
You might be expecting something different.
Try this...
Instead of setTile(j, i, (i * numCols) + j);
Let's use tile 1 or tile 9...
Change that line to setTile(j, i, 1) or setTile(j, i, 9)
You see a 16x16 pattern repeated.
The 12 tiles are extracted from spacetiles.gif, which is 64x48 pixels
In SpaceMap.as the size of the square is 16x16...
tiles.loadTiles("spacetiles.gif", 16);
So in TileSet.as the size is 16 and the data from spacetiles.gif, is 64x48
and numTilesH become 64/16 =4 across and
numTilesV becomes 48/16 =3 down
giving 12 tiles in the set
TileSet.as, line 73...
public function convertBitmapToTiles (size:int,
data:BitmapData):Array {
var newTileSet:Array = new Array();
var numTilesH:int = data.width/size;
var numTilesV:int = data.height/size;
for (var i:int = 0; i < numTilesV; i++) {
for (var j:int = 0; j < numTilesH; j++) {
newTileSet.push(data.getPixels(new Rectangle(j*size, i*size,
size, size)));
}
}
return newTileSet; // 12 tiles in the set
}
The tiles are the 16x16 and these make the star field.
The drag field is separate to that.
I have benefited from looking at this code, and other code,
and I am pleased to be able to give something back
Moock did a great job. Hope that helps.
John
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders