Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Snaptothegrid

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Snaptothegrid's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Ehm, I corrected the following lines: ``` var rect3=new Rectangle(rect1.x,rect1.y+32+(32-dy/2),rect1.width,rect1.height); // instead of dy-dy/2 ``` ``` var rect4=new Rectangle(rect2.x,rect2.y+32+(32-dy/2),rect2.width,rect2.height); // instead of dy-dy/2 ``` so now the walls can be of any pixel height.
  2. Ok i managed to implement wall autotiling even if the implementation its a bit dirty still. I found this article about autotiling and walls: http://pixel.oceansdream.net/?cat=4 and i wrote this routine in as3: ``` public function DrawWall(layer, x, y, origin:Point=null, rect:Rectangle=null, color:uint=0xFFFFFF) { var dy=64; origin=new Point(origin.x,-dy+origin.y); var rect=new Rectangle(map.tiles[layer][x][y].bmpRect.x+rect.x, map.tiles[layer][x][y].bmpRect.y+rect.y, rect.width, rect.height); map.bmpData.copyPixels(map.tiles[layer][x][y].tileset.bmpData, rect, origin); origin=new Point(x*32,32-dy+y*32); var rect1=new Rectangle(map.tiles[layer][x][y].bmpRect.x+0, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); var rect2=new Rectangle(map.tiles[layer][x][y].bmpRect.x+0, map.tiles[layer][x][y].bmpRect.y+96, 0, 0); if (TileExists(layer,x,y,Direction.Right)) { rect2=new Rectangle(map.tiles[layer][x][y].bmpRect.x+16, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); } if (TileExists(layer,x,y,Direction.Left)) { rect1=new Rectangle(map.tiles[layer][x][y].bmpRect.x+32, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); rect2=new Rectangle(map.tiles[layer][x][y].bmpRect.x+48, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); } if (!TileExists(layer,x,y,Direction.Left) && !TileExists(layer,x,y,Direction.Right)) { rect2=new Rectangle(map.tiles[layer][x][y].bmpRect.x+48, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); } if (TileExists(layer,x,y,Direction.Left) && TileExists(layer,x,y,Direction.Right)) { rect1=new Rectangle(map.tiles[layer][x][y].bmpRect.x+16, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); rect2=new Rectangle(map.tiles[layer][x][y].bmpRect.x+32, map.tiles[layer][x][y].bmpRect.y+96, 16, dy/2); } map.bmpData.copyPixels(map.tiles[layer][x][y].tileset.bmpData, rect1, origin); map.bmpData.copyPixels(map.tiles[layer][x][y].tileset.bmpData, rect2, new Point(origin.x+16,origin.y)); var rect3=new Rectangle(rect1.x,rect1.y+dy-dy/2,rect1.width,rect1.height); map.bmpData.copyPixels(map.tiles[layer][x][y].tileset.bmpData, rect3, new Point(origin.x,origin.y+dy/2)); var rect4=new Rectangle(rect2.x,rect2.y+dy-dy/2,rect2.width,rect2.height); map.bmpData.copyPixels(map.tiles[layer][x][y].tileset.bmpData, rect4, new Point(origin.x+16,origin.y+dy/2)); } ``` So this function is used instead of Draw function if the tile is a wall. The 'dy' var defines the 'height' of the wall, so you can have walls of 1(32) or 2(64) tiles of height. and the function autotiles the wall roof as normal autotiling (as implemented by MrMiguu) and then autotiles the wall surface too. I'll try to upload the as3 movie somewhere soon if anybody is interested. Cheers!
  3. Lel, as i see it, it is a diferent program indeed. It's a demonstration of the logic of autotiling using the rpgmaker tileset structure. You can learn a lot from it if you are interested on what is moving under the ropes dough. Some kids playing style is to 'open' the toys to see what's inside :)
  4. Thanks for the reply, take your time, not in a hurry here!
  5. Hey amazing implementation you did there Mr.Miguu! I was in the middle of the programming of an as3 tile engine when i suddently found it. I already ported it to as3 and it works like charm. So how about the wall tiles? I can see in VX walls also have some autotile algorithm, but it differs from the terrain tiles for the 'wall' part of the wall. I mean, the walls tilesets (A3, A4) are 2 cells larger Terrain: xo ** ** Wall: xo ** ** ++ I can see both parts (* and +) are autotiled, but i cant manage to find the correct algorithm for the ++ tiles… Any ideas?
×
×
  • Create New...