Android Open Source - AmazingGame Tile Click Helper






From Project

Back to project page AmazingGame.

License

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.

Java Source Code

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()
  {

  }
}




Java Source Code List

game.IOSLauncher.java
game.MyGdxGame.java
game.android.AndroidLauncher.java
game.client.HtmlLauncher.java
game.desktop.DesktopLauncher.java
game.generator.MapGenerator.java
game.helpers.AssetLoader.java
game.helpers.Constants.java
game.helpers.MapHelper.java
game.helpers.TileClickHelper.java
game.input.MapInputHandler.java
game.objects.BlurpleBuilding.java
game.objects.BurnedMoose.java
game.objects.Grass.java
game.objects.PoopDesert.java
game.objects.River.java
game.objects.TileSprite.java
game.objects.Tree.java
game.objects.Unit.java
game.objects.Wall.java
game.objects.Water.java
game.screens.GameScreen.java
game.world.GameMap.java
game.world.GameRenderer.java
game.world.PlayerManager.java