}
for (Item p : itemList) {
if (p instanceof SpeedBoost) {
SpeedBoost s = (SpeedBoost) p;
SpeedBoostRectangle tRect = s.getRectangle();
g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
null);
}
if (p instanceof IceBlock) {
IceBlock s = (IceBlock) p;
IceBlockRectangle tRect = s.getRectangle();
g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
null);
}
if (p instanceof BubbleShield) {
BubbleShield s = (BubbleShield) p;
BubbleShieldRectangle tRect = s.getRectangle();
g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
null);
}
}
for (int i = 0; i < obstacleList.size(); i++) {
Obstacle p = obstacleList.get(i);
if (p instanceof Crate) {// for instance of crate
Crate c = (Crate) p;
CrateRectangle cRect = c.getRectangle();
g.drawImage(cRect.getImage(), cRect.xCoord(), cRect.yCoord(),
null);
}
if (p instanceof ImmovableBlock) {// for instance of immovableBlock
ImmovableBlock ib = (ImmovableBlock) p;
ImmovableBlockRectangle ibRect = ib.getRectangle();
g.drawImage(ibRect.getImage(), ibRect.xCoord(),
ibRect.yCoord(), null);
}
if (p instanceof FireRing) {// for instance of fireRing
FireRing fr = (FireRing) p;
FireRingRectangle frRect = fr.getRectangle();
g.setColor(frRect.setColor());
g.drawImage(fr.getImage(), frRect.xCoord(), frRect.yCoord(),
null);
}
if (p instanceof TNT) {// for instance of TNT
TNT tnt = (TNT) p;
TNTRectangle tntRect = tnt.getRectangle();
g.drawImage(tntRect.getImage(), tntRect.xCoord(),
tntRect.yCoord(), null);
}
}
for (PlayerTank p : tankList) {
TankRectangle tRect = p.getRectangle();
g.drawImage(p.getImage(), tRect.xCoord(), tRect.yCoord(), null);
}
for (EnemyTank p : enemyList) {
TankRectangle tRect = p.getRectangle();
g.drawImage(p.getImage(), tRect.xCoord(), tRect.yCoord(), null);
}
for (Projectile p : projectileList) {
if (p instanceof PlayerProjectile) {
PlayerProjectile s = (PlayerProjectile) p;
ProjectileRectangle rect = s.getRectangle();
g.drawImage(rect.getImage(), rect.xCoord(), rect.yCoord(), null);
}
if (p instanceof EnemyProjectile) {
EnemyProjectile s = (EnemyProjectile) p;
ProjectileRectangle rect = s.getRectangle();
g.drawImage(rect.getImage(), rect.xCoord(), rect.yCoord(), null);
}
}
for (Explosion p : explosionList) {
g.drawImage(p.getImage(), p.getLocation().col, p.getLocation().row,
null);
}
if (won == true) {
Font font = new Font("Times New Roman", Font.BOLD, 28);
String jb = "Mission Complete!";
AttributedString att = new AttributedString(jb);
att.addAttribute(TextAttribute.FOREGROUND, Color.YELLOW);
att.addAttribute(TextAttribute.FONT, font);
g.drawString(att.getIterator(), 400, 350);
}
if (lost == true) {
Font font = new Font("Times New Roman", Font.BOLD, 28);
String jb = "Mission Failed!";
AttributedString att = new AttributedString(jb);
att.addAttribute(TextAttribute.FOREGROUND, Color.RED);
att.addAttribute(TextAttribute.FONT, font);
g.drawString(att.getIterator(), 400, 350);
}
if (gameOver == true) {
Font font = new Font("Times New Roman", Font.BOLD, 44);
String jb = "Game Over!";
AttributedString att = new AttributedString(jb);
att.addAttribute(TextAttribute.FOREGROUND, Color.ORANGE);
att.addAttribute(TextAttribute.FONT, font);
g.drawString(att.getIterator(), 370, 350);
}
for (int i = 0; i < 700; i += 50) {
for (int j = 985; j < 1200; j += 50) {
if (i == 150 || i == 200 || i == 350 || i == 400) {
g.drawImage(steel, j, i, null);
} else {
g.drawImage(camo, j, i, null);
}
}
}
for (int i = 690; i < 900; i += 20) {
for (int j = 0; j < 1200; j += 20) {
g.drawImage(gold, j, i, null);
}
}
for (int i = 0; i < 700; i += 20) {
for (int j = 985; j < 1200; j += 20) {
if (i == 0 || i == 680 || j == 985 || j == 1165) {
g.drawImage(gold, j, i, null);
}
}
}
for (int i = 0; i < 900; i += 20) {
for (int j = 1180; j < 1500; j += 20) {
g.drawImage(gold, j, i, null);
}
}
Font font = new Font("Times New Roman", Font.BOLD, 20);
String lives = "Lives Remaning";
AttributedString att = new AttributedString(lives);
att.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
att.addAttribute(TextAttribute.FONT, font);
g.drawString(att.getIterator(), 1018, 44);
for (int i = 0; i < MasterView.playerLives; i++) {
for (int j = 0; j < MasterView.playerLives * 50; j += 55) {
g.drawImage(wheel, 1005 + j, 65, null);
}
}
String curr = "Current Level: " + currentMap.getLevelNumber();
AttributedString att3 = new AttributedString(curr);
att3.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
att3.addAttribute(TextAttribute.FONT, font);
g.drawString(att3.getIterator(), 1013, 300);
String item = "Active Items";
AttributedString att6 = new AttributedString(item);
att6.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
att6.addAttribute(TextAttribute.FONT, font);
g.drawString(att6.getIterator(), 1030, 485);
if (player.isActiveShield()) {
g.drawImage(new BubbleShieldRectangle(-10, -10).getImage(), 1020,
515, null);
}
if (player.isActiveBoost()) {
g.drawImage(new SpeedBoostRectangle(-10, -10).getImage(), 1100,
515, null);
}
}