summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/actors/HexMap.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/actors/HexMap.java b/core/src/ch/asynk/tankontank/actors/HexMap.java
index 559aeef..a6ee636 100644
--- a/core/src/ch/asynk/tankontank/actors/HexMap.java
+++ b/core/src/ch/asynk/tankontank/actors/HexMap.java
@@ -1,6 +1,7 @@
package ch.asynk.tankontank.actors;
import com.badlogic.gdx.graphics.Texture;
+import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.math.Vector2;
@@ -27,6 +28,13 @@ public class HexMap extends Image
this.rows = rows;
}
+ public void centerActorOn(Actor actor, int col, int row)
+ {
+ int x = x0 + (int) ((col * w) + ((w - actor.getWidth()) / 2));
+ int y = y0 + (int) ((row * H) + ((h - actor.getWidth()) / 2));
+ actor.setPosition(x, y);
+ }
+
public void selectCell(float cx, float cy)
{
// compute row