import java.util.Random; public class Tile { /**These Values are being set when initialized */ int size, posx, posy; /**The Value of this Integer determines who owns this Tile * -1 = no one; 0 = Player 1; 1 = Player 2 */ int owner = -1; /**Random for Images * */ Random rnd = new Random(); /**Paths for the images * */ String imagePathPlayer = "./textures/" + owner + "_" + rnd.nextInt(3); String imagePathEmpty = "./textures/empty"; /**Initializer for Tile Objects * @param size Sets the Size of the Image * @param posx Sets the x-Position of the Image * @param posy Sets the y-Position of the Image */ public Tile(int size, int posx, int posy){ size = this.size; posx = this.posx; posy = this.posy; } /**Lets you set a new owner; * -1 = no one; 0 = Player 1; 1 = Player 2 * @param owner */ public void set_owner(int player){ owner = player; } /**Returns the owner * -1 = no one; 0 = Player 1; 1 = Player 2 * @return owner */ public int get_owner(){ return owner; } /**Returns if the Tile-owner is equal to the given Player * @param owner */ public boolean is_owner(int player){ return owner == player; } /**Whether this Tile is owned by a Player */ public boolean exist_owner(){ return owner != -1; } }