cicaprojekt/cicaprojekt/PlayerDrawer.java
2016-05-13 22:10:54 +02:00

105 lines
3.1 KiB
Java

package cicaprojekt;
import java.io.IOException;
public class PlayerDrawer extends AbstractDrawer implements Drawer {
Player player;
public PlayerDrawer(Player p) throws IOException {
super("ONeill_Down.png");
player = p;
}
@Override
public void draw() throws IOException {
if (player.hasBox()) {
switch (player.name) {
case "O'Neill":
switch (player.facingDirection) {
case NORTH:
changeImage("ONeill_Up_Box.png");
break;
case EAST:
changeImage("ONeill_Right_Box.png");
break;
case SOUTH:
changeImage("ONeill_Down_Box.png");
break;
default:
changeImage("ONeill_Left_Box.png");
break;
}
break;
default:
switch (player.facingDirection) {
case NORTH:
changeImage("Jaffa_Up_Box.png");
break;
case EAST:
changeImage("Jaffa_Right_Box.png");
break;
case SOUTH:
changeImage("Jaffa_Down_Box.png");
break;
default:
changeImage("Jaffa_Left_Box.png");
break;
}
break;
}
}
else {
switch (player.name) {
case "O'Neill":
switch (player.facingDirection) {
case NORTH:
changeImage("ONeill_Up.png");
break;
case EAST:
changeImage("ONeill_Right.png");
break;
case SOUTH:
changeImage("ONeill_Down.png");
break;
default:
changeImage("ONeill_Left.png");
break;
}
break;
default:
switch (player.facingDirection) {
case NORTH:
changeImage("Jaffa_Up.png");
break;
case EAST:
changeImage("Jaffa_Right.png");
break;
case SOUTH:
changeImage("Jaffa_Down.png");
break;
default:
changeImage("Jaffa_Left.png");
break;
}
break;
}
}
if(player.isDestroyed())
changeImage("Empty.png");
}
@Override
public int getTileX() {
return player.getCurrentTile().getX();
}
@Override
public int getTileY() {
return player.getCurrentTile().getY();
}
}