/* * Makes a tile with the terrain that corresponds to the input type. Initializes canMoveTo to false, is only true when calculating/displaying a player's move options * Does not add a character, sets to null * * int terrain = the number corresponding to the desired type of terrain. 0 for grass, 1 for mountain, 2 for water, 3 for swamp. */ public Tile(int r, int c, int terrain) { row = r; col = c; canMoveTo = false; terrainType = terrain; tileTerrain_obj = new Terrain(terrain); aCharacter = null; numAttackOption = 0; if (terrain == 1 || terrain == 2) //will probably be changed later depending on actual tiles/tile file format system used later. isSolid = true; else isSolid = false; if (terrain == 3) //will probably be changed later speedToMoveThrough = 2; else speedToMoveThrough = 1; }
//Constructors /* * Makes a "blank" tile, default is grass, no character on it. Initializes canMoveTo to false, is only true when calculating/displaying a player's move options * Does not add a character, sets to null */ public Tile(int r, int c) { row = r; col = c; canMoveTo = false; terrainType = 0; speedToMoveThrough = 1; aCharacter = null; isSolid = false; numAttackOption = 0; }