Skip to content
Permalink
4cd86f04b1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
48 lines (38 sloc) 1.07 KB
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public enum TowerTypes {
//NAME (Cost to buy, Cost to sell, "sprite dir")
NEXUS (1, 1, "Nexus Tower.png"),
BASIC (50, 25, "Basic Tower.png"),
AOE (100, 50, "AOE Tower.png");
private int _buycost, _sellcost;
private BufferedImage sprite;
private static final String SPRITE_FILE_DIR = "src/resources/images/";
TowerTypes(int buycost, int sellcost, String spriteFileName) {
this._buycost = buycost;
this._sellcost = sellcost;
try {
this.sprite = ImageIO.read(new File(SPRITE_FILE_DIR.concat(spriteFileName)));
} catch (IOException ex) {
System.out.println("image not found");
}
}
public int getBuycost() {
return _buycost;
}
public int getSellcost() {
return _sellcost;
}
public String getName() {
return this.toString();
}
public TowerTypes getTowerType(){
return this;
}
public BufferedImage getSprite()
{
return sprite;
}
}