summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-10-17 16:01:16 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-10-17 16:01:16 +0200
commit661b01f18465a1d23953e1bd87ef3d8579637092 (patch)
tree0867025b10eefcde6a7623c0e5bfcb920d5135dc
parentfc7828cc401b616b2bf8ccc7161e697e60d5a8a5 (diff)
downloadgdx-boardgame-661b01f18465a1d23953e1bd87ef3d8579637092.zip
gdx-boardgame-661b01f18465a1d23953e1bd87ef3d8579637092.tar.gz
Orientation : add fromTiles(Tile, Tile)
-rw-r--r--core/src/ch/asynk/gdx/boardgame/Orientation.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Orientation.java b/core/src/ch/asynk/gdx/boardgame/Orientation.java
index 835afe4..677c979 100644
--- a/core/src/ch/asynk/gdx/boardgame/Orientation.java
+++ b/core/src/ch/asynk/gdx/boardgame/Orientation.java
@@ -1,5 +1,7 @@
package ch.asynk.gdx.boardgame;
+import com.badlogic.gdx.math.MathUtils;
+
public enum Orientation
{
ALL(255, 0),
@@ -87,4 +89,9 @@ public enum Orientation
else return KEEP;
}
+
+ public static Orientation fromTiles(Tile from, Tile to)
+ {
+ return fromR(MathUtils.atan2((to.y - from.y), (to.x - from.x)) * MathUtils.radiansToDegrees);
+ }
}