|
@@ -112,7 +112,9 @@ class Tile {
|
|
|
return t;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ Split horizontaly or verticaly the number of given frames
|
|
|
+ **/
|
|
|
public function split( frames : Int, vertical = false ) {
|
|
|
var tl = [];
|
|
|
if( vertical ) {
|
|
@@ -126,6 +128,13 @@ class Tile {
|
|
|
}
|
|
|
return tl;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ Split the tile into a list of tiles of Size x Size pixels.
|
|
|
+ **/
|
|
|
+ public function grid( size : Int, dx = 0, dy = 0 ) {
|
|
|
+ return [for( y in 0...Std.int(height / size) ) for( x in 0...Std.int(width / size) ) sub(x * size, y * size, size, size, dx, dy)];
|
|
|
+ }
|
|
|
|
|
|
public function toString() {
|
|
|
return "Tile(" + x + "," + y + "," + width + "x" + height + (dx != 0 || dy != 0 ? "," + dx + ":" + dy:"") + ")";
|