PlayerDrawer.java added.

This commit is contained in:
ericnerdo 2016-05-07 22:19:55 +02:00
parent c854a1ed37
commit 25fd8189d2

View File

@ -0,0 +1,67 @@
package cicaprojekt;
import java.io.IOException;
public class PlayerDrawer extends ImagePanel implements Drawer {
Player player;
public PlayerDrawer(Player p) throws IOException {
super("ONeill.png");
player = p;
setVisible(false);
}
@Override
public void draw() throws IOException {
//TODO Pictures for different facing directions.
switch(player.name){
case "O'Neill":
switch(player.facingDirection){
case NORTH:
changeImage("ONeill.png");
break;
case EAST:
changeImage("ONeill.png");
break;
case SOUTH:
changeImage("ONeill.png");
break;
default:
changeImage("ONeill.png");
break;
}
break;
default:
switch(player.facingDirection){
case NORTH:
changeImage("Jaffa.png");
break;
case EAST:
changeImage("Jaffa.png");
break;
case SOUTH:
changeImage("Jaffa.png");
break;
default:
changeImage("Jaffa.png");
break;
}
break;
}
setVisible(true);
}
@Override
public int getTileX() {
return player.getCurrentTile().getX();
}
@Override
public int getTileY() {
return player.getCurrentTile().getY();
}
}