-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TowerTypes class added to place Basic and AOE towers and their sprites
- Loading branch information
Showing
6 changed files
with
110 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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 BufferedImage getSprite() | ||
{ | ||
return sprite; | ||
} | ||
} |