Back to project page AmazingGame.
The source code is released under:
GNU General Public License
If you think the Android project AmazingGame listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package game.helpers; /*from w w w. ja v a 2 s. com*/ import java.util.Scanner; import game.objects.TileSprite; public class TileClickHelper { private TileSprite[][] map; private int currentSelectX; private int currentSelectY; public TileClickHelper(TileSprite[][] map) { this.map = map; currentSelectX = -1; currentSelectY = -1; } public void recieveMessage(String msg) { String purpose = msg.substring(0, msg.indexOf(" ")); switch (purpose) { case "SELECT": Scanner s = new Scanner(msg); s.next(); select(s.nextInt(), s.nextInt()); s.close(); } } private void select(int x, int y) { if (map[x][y].getUnit() == null) { map[x][y].selectNormal(); if(currentSelectX != -1&& currentSelectY != -1) { if(map[x][y].isSelected()) { map[x][y].unSelectNormal(); } else if(!map[x][y].isSelected()) { map[x][y].selectNormal(); } } } else { } } private void findMovement() { } private void findAttack() { } }