Hey folks,
I'm currently writing a game. The game uses 32x32 tiles and is drawn to a SurfaceView. Trouble is, that when the map area is drawn, the 32x32 tiles wont draw correctly unless I manually set the draw routine to draw them at a tile size of 44x44 ?! Is this android, or me? I don't want to show all the code, due to my (eventually) wanting to stick it on the market, but here are some snippets of the problem code:
... and the main drawing routine for each tile
and a few others if it helps:
- I'm not sure what the problem is, but using the TILE_SIZE_2 member will make the map draw perfectly, but will in turn knock out all of the collision detection I have up and running.
Any help is greatly appreciated. This isn't my first game, but it is my first tile based game on android, and rather than using an engine, I thought I'd start from scratch, but this is quite litterally doing my head in!
I should point out that I have indeed checked that my tiles are indeed 32x32 - MANY times ....
TIA.
{edit - The functions didn't paste correctly... This isn't intentional }
I'm currently writing a game. The game uses 32x32 tiles and is drawn to a SurfaceView. Trouble is, that when the map area is drawn, the 32x32 tiles wont draw correctly unless I manually set the draw routine to draw them at a tile size of 44x44 ?! Is this android, or me? I don't want to show all the code, due to my (eventually) wanting to stick it on the market, but here are some snippets of the problem code:
Code:
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_WIDTH[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = 240;[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_HEIGHT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = 320;[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = 32; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// max tile dimensions[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE_2[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = 44; // stupidly sized tiles for correct drawing...???[/SIZE]
Code:
[LEFT][SIZE=2][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Bitmap [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dirtTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = BitmapFactory.[I]decodeResource[/I](getResources(), R.drawable.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dirt_01[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/SIZE][SIZE=2]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Bitmap [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]goldTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = BitmapFactory.[I]decodeResource[/I](getResources(), R.drawable.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dirt_gold[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Bitmap [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]silverTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = BitmapFactory.[I]decodeResource[/I](getResources(), R.drawable.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dirt_silver[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Bitmap [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]copperTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = BitmapFactory.[I]decodeResource[/I](getResources(), R.drawable.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dirt_copper[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Bitmap [/SIZE][U][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]startTile[/COLOR][/SIZE][/COLOR][/SIZE][/U][SIZE=2] = BitmapFactory.[I]decodeResource[/I](getResources(), R.drawable.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dave_start[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[/SIZE]
Code:
[LEFT][SIZE=2][SIZE=2][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] createBlankMap(){[/SIZE][/SIZE][SIZE=2]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] x=0; x<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_WIDTH[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; x++){[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] y=0; y<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_HEIGHT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; y++){[/SIZE]
[SIZE=2]setMapData(x, y, [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]DEFAULT_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] mapStringToMap(String mapString){[/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// clear the map first[/COLOR][/SIZE][/COLOR][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] i= 0;[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] x = 0; x<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_WIDTH[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; x++){[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] y =0; y<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_HEIGHT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; y++){[/SIZE]
[SIZE=2]setMapData(x, y, Integer.[I]parseInt[/I](String.[I]valueOf[/I](mapString.charAt(i))));[/SIZE]
[SIZE=2]i++;[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]} [/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] setMapData([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] x, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] y, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] v){[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]map_area[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][x][y] = v;[/SIZE][/LEFT]
[SIZE=2]}[/SIZE]
[/SIZE][/SIZE]
... and the main drawing routine for each tile
Code:
[LEFT][SIZE=2][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] drawMapTiles(Canvas canvas){[/SIZE][/SIZE][SIZE=2]
[SIZE=2]Paint p = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Paint();[/SIZE]
[SIZE=2]p.setColor(Color.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]WHITE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2]p.setStyle(Paint.Style.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]STROKE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] x=0; x<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_WIDTH[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; x++){[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] y=0; y<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_HEIGHT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; y++){[/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// DRAW GRID[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// DIRT SPRITE DEFAULT TILE //////////////////////////////////////////////////////////////////////[/COLOR][/SIZE][/COLOR][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](getMapData(x,y) == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]DEFAULT_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]){[/SIZE]
[SIZE=2]canvas.drawBitmap([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dirtTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], x*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], y*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE][/LEFT]
[LEFT][SIZE=2]}[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](getMapData(x,y) == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GOLD_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]){[/SIZE]
[SIZE=2]canvas.drawBitmap([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]goldTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], x*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], y*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE][/LEFT]
[LEFT][SIZE=2]}[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](getMapData(x,y) == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SILVER_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]){[/SIZE]
[SIZE=2]canvas.drawBitmap([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]silverTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], x*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], y*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE][/LEFT]
[LEFT][SIZE=2]}[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](getMapData(x,y) == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]COPPER_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]){[/SIZE]
[SIZE=2]canvas.drawBitmap([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]copperTile[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], x*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], y*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE][/LEFT]
[LEFT][SIZE=2]}[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](getMapData(x,y) == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]START_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]){[/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// reset this tile to a default dirt block, so we don't see the[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// player start[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// draw the default dirt tile[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dave[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setX(x*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dave[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setY(y*[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](![/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]editor_mode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){ [/SIZE]
[SIZE=2]setMapData(x, y, [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]DEFAULT_TILE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
[LEFT][SIZE=2]} [/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
[SIZE=2]}[/SIZE]
[/SIZE]
and a few others if it helps:
Code:
[LEFT][SIZE=2][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] getMapData([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] x, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] y){[/SIZE][/SIZE][SIZE=2]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]map_area[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][x][y];[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String mapDataToString(){[/SIZE]
[SIZE=2]StringBuilder sb = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] StringBuilder();[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] x=0; x<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_WIDTH[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; x++){[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] y=0; y<[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MAX_HEIGHT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]/[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TILE_SIZE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]; y++){[/SIZE]
[SIZE=2]sb.append(getMapData(x, y));[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] sb.toString();[/SIZE][/LEFT]
[SIZE=2]}[/SIZE]
[/SIZE]
- I'm not sure what the problem is, but using the TILE_SIZE_2 member will make the map draw perfectly, but will in turn knock out all of the collision detection I have up and running.
Any help is greatly appreciated. This isn't my first game, but it is my first tile based game on android, and rather than using an engine, I thought I'd start from scratch, but this is quite litterally doing my head in!
I should point out that I have indeed checked that my tiles are indeed 32x32 - MANY times ....
TIA.
{edit - The functions didn't paste correctly... This isn't intentional }