Browse Source

added xFlip,yFlip properties (close #736)

Nicolas Cannasse 5 years ago
parent
commit
8cd733a89c
1 changed files with 14 additions and 0 deletions
  1. 14 0
      h2d/Tile.hx

+ 14 - 0
h2d/Tile.hx

@@ -16,6 +16,9 @@ class Tile {
 	public var y(default,null) : Float;
 	public var y(default,null) : Float;
 	public var width(default,null) : Float;
 	public var width(default,null) : Float;
 	public var height(default,null) : Float;
 	public var height(default,null) : Float;
+	
+	public var xFlip(get,set) : Bool;
+	public var yFlip(get,set) : Bool;
 
 
 	public var ix(get,never) : Int;
 	public var ix(get,never) : Int;
 	inline function get_ix() return Math.floor(x);
 	inline function get_ix() return Math.floor(x);
@@ -136,6 +139,17 @@ class Tile {
 		t.v2 = v2;
 		t.v2 = v2;
 		return t;
 		return t;
 	}
 	}
+	
+	function get_xFlip() return u2 < u;
+	function get_yFlip() return v2 < v;
+	function set_xFlip(v) {
+		if( v != xFlip ) flipX();
+		return v;
+	}
+	function set_yFlip(v) {
+		if( v != yFlip ) flipY();
+		return v;
+	}
 
 
 	/**
 	/**
 		Split horizontaly or verticaly the number of given frames
 		Split horizontaly or verticaly the number of given frames