Android Open Source - linevslinerpg Map






From Project

Back to project page linevslinerpg.

License

The source code is released under:

Apache License

If you think the Android project linevslinerpg 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 com.jmpmain.lvslrpg;
/*w w w  .  ja v a2 s .com*/
import java.util.Vector;

import android.graphics.Point;

public class Map {

  public enum TileType{
    Empty,
    Grass,
    Water,
    Sand,
    Forest,
    Mountain,
    Hill,
    Snow
  }
  
  /** Tile type array. The map array. */
  private TileType map[][];
  
  private boolean damageMap[][];
  
  /** Map width in tiles. */
  public int width;
  /** Map height in tiles. */
  public int height;
  
  public int tileSize;
  
  public Point city;
  
  public Point playerStart;
  
  public Vector<Point> enemyStarts;
  
  /** LineCanvas where line vs line battles are rendered. */
  public LineCanvas lineCanvas;
  
  public Map(int w, int h, int t){
    tileSize = t;

    lineCanvas = new LineCanvas(w, h);
    
    enemyStarts = new Vector<Point>();
    
    width = w/t;
    height = h/t;
    map = new TileType[height][width];
    damageMap = new boolean[height][width];
    
    for(int r = 0; r < height; r++){
      for(int c = 0; c < width; c++){
        map[r][c] = TileType.Empty;
        damageMap[r][c] = false;
      }
    }
  }
  
  public TileType getTile(int x, int y){
    return map[y][x];
  }
  
  public boolean getDamage(int x, int y){
    return damageMap[y][x];
  }
  
  public void setTile(int x, int y, TileType type) {
    map[y][x] = type;
    if(type == TileType.Water){
      setTileDamage(x, y, true);
    }
  }
  
  public void setTileDamage(int x, int y, boolean damage){
    damageMap[y][x] = damage;
  }
  
}




Java Source Code List

com.jmpmain.lvslrpg.AudioPlayer.java
com.jmpmain.lvslrpg.GameSurface.java
com.jmpmain.lvslrpg.GameThread.java
com.jmpmain.lvslrpg.LineCanvas.java
com.jmpmain.lvslrpg.MainActivity.java
com.jmpmain.lvslrpg.MapGenerator.java
com.jmpmain.lvslrpg.Map.java
com.jmpmain.lvslrpg.OptionsAdapter.java
com.jmpmain.lvslrpg.entities.AILineEntity.java
com.jmpmain.lvslrpg.entities.Entity.java
com.jmpmain.lvslrpg.entities.Item.java
com.jmpmain.lvslrpg.entities.LineEntity.java
com.jmpmain.lvslrpg.entities.PlayerLineEntity.java
com.jmpmain.lvslrpg.particles.Blood.java
com.jmpmain.lvslrpg.particles.Bomb.java
com.jmpmain.lvslrpg.particles.Energy.java
com.jmpmain.lvslrpg.particles.Heal.java
com.jmpmain.lvslrpg.particles.ItemParticle.java
com.jmpmain.lvslrpg.particles.Particle.java
com.jmpmain.lvslrpg.particles.Smoke.java