diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-31 12:05:24 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-31 12:05:24 +0200 |
commit | a0b0ae5396df26c1a65081b093709696a0c0166e (patch) | |
tree | 91d6be1e125b178e53fad3ff18d9f556d259c237 /core/src/ch/asynk/gdx/boardgame/Piece.java | |
parent | 0460996fd80f041d2d0e3a0ec1ec98be96bc6af6 (diff) | |
download | gdx-boardgame-a0b0ae5396df26c1a65081b093709696a0c0166e.zip gdx-boardgame-a0b0ae5396df26c1a65081b093709696a0c0166e.tar.gz |
Board/Piece : add dropInPlace(…), dropOnBoard(…)
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/Piece.java')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/Piece.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Piece.java b/core/src/ch/asynk/gdx/boardgame/Piece.java index ee0353a..6d2bf52 100644 --- a/core/src/ch/asynk/gdx/boardgame/Piece.java +++ b/core/src/ch/asynk/gdx/boardgame/Piece.java @@ -10,6 +10,7 @@ import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.MathUtils; +import ch.asynk.gdx.boardgame.boards.Board; import ch.asynk.gdx.boardgame.Drawable; import ch.asynk.gdx.boardgame.Orientation; import ch.asynk.gdx.boardgame.Positionable; @@ -44,6 +45,13 @@ public class Piece implements Drawable, Positionable, Rotable, Scalable setRotation(r); } + public void dropOnBoard(Board board, Vector2 v) + { + board.toBoard(getCX(), getCY(), v); + board.centerOf((int)v.x, (int)v.y, v); + centerOn(v.x, v.y); + } + public boolean isOn(Tile tile) { return ( |