summaryrefslogtreecommitdiffstats
path: root/src/subconscious/graphics/BattleScene.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/subconscious/graphics/BattleScene.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/subconscious/graphics/BattleScene.java b/src/subconscious/graphics/BattleScene.java
index 5199ecc..6d41c2d 100644
--- a/src/subconscious/graphics/BattleScene.java
+++ b/src/subconscious/graphics/BattleScene.java
@@ -28,6 +28,7 @@ import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
+@SuppressWarnings("serial")
public class BattleScene extends MapScene {
private enum Mode {
@@ -260,13 +261,17 @@ public class BattleScene extends MapScene {
public void mouseMoved(MouseEvent e) {
this.realX = e.getX();
this.realY = e.getY();
+
int tileSize = this.maxSize/10;
Point2D p = new Point2D.Double(e.getX(), e.getY());
+
try {
p = this.tx.inverseTransform(p, null);
} catch (NoninvertibleTransformException ex) {}
+
int x = (int) (p.getX()/tileSize);
int y = (int) (p.getY()/tileSize);
+
try {
Tile tile = this.map.getTile(x, y);
if (x != this.previousX || y != this.previousY) {
@@ -285,9 +290,9 @@ public class BattleScene extends MapScene {
this.previousY = y;
}
} catch (ArrayIndexOutOfBoundsException ex) {
- System.out.println("no tile clicked");
+ // System.out.println("no tile clicked");
} catch (NullPointerException ext) {
- System.out.println("map non existent");
+ // System.out.println("map non existent");
}
}