Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
add spacing support, fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kaster committed Feb 6, 2014
1 parent b31d6fd commit d4347cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions openfl/tiled/Layer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ class Layer {
throw "TmxLayer - data compression type not supported!";
}
}
tileGIDs = base64ToArray(chunk, width, compressed);
tileGIDs = base64ToArray(chunk, width, compressed);
case "csv":
chunk = child.firstChild().nodeValue;
tileGIDs = csvToArray(chunk);
default:
for (tile in child) {
if (Helper.isValidElement(tile)) {
var gid = Std.parseInt(tile.get("gid"));
var gid = Std.parseInt(tile.get("gid"));
tileGIDs.push(gid);
}
}
Expand Down
7 changes: 4 additions & 3 deletions openfl/tiled/Tileset.hx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class Tileset {
/** The image of this tileset */
public var image:TilesetImage;

private function new(name:String, tileWidth:Int, tileHeight:Int, spacing:Int, properties:Map<String, String>, image:TilesetImage) {
private function new(name:String, tileWidth:Int, tileHeight:Int, spacing:Int,
properties:Map<String, String>, image:TilesetImage) {
this.name = name;
this.tileWidth = tileWidth;
this.tileHeight = tileHeight;
Expand Down Expand Up @@ -134,8 +135,8 @@ class Tileset {
var texturePositionY:Float = getTexturePositionByGID(gid).y;

var texture:BitmapData = Helper.getBitmapData(this.image.source);
var rect:Rectangle = new Rectangle((texturePositionX * this.tileWidth) + (texturePositionX * spacing),
(texturePositionY * this.tileHeight) + (texturePositionY * spacing), this.tileWidth, this.tileHeight);
var rect:Rectangle = new Rectangle((texturePositionX * this.tileWidth) + (texturePositionX + spacing),
(texturePositionY * this.tileHeight) + (texturePositionY + spacing), this.tileWidth, this.tileHeight);

trace("X: " + rect.x + ", Y: " + rect.y);

Expand Down

0 comments on commit d4347cc

Please sign in to comment.