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

AutoTile Reference


mrmiguu
 Share

Recommended Posts

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 :)
Link to comment
Share on other sites

@Snaptothegrid:

> Some kids playing style is to 'open' the toys to see what's inside :)

And put it back together either into the original state, or something different. =]
I was able to put this back into an original state, except to work with RMXP style.
Later, I was able to put this into VB6 and now it's in my game =]

Sincerely,
Rithy
Link to comment
Share on other sites

Wow! really guys, ever since I got here, you have all been nothing but polite and quick with answers.
I've noticed some rude comments from "some" people but for the most part I noticed that is because I see they say very dumb things or ask things that are easy to find.

Anyways, thanks guys.
Link to comment
Share on other sites

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!
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...