diff options
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/Orientation.java | 7 |
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); + } } |