From 25fd8189d2b6097951ca8868de40a4c2835ba80d Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Sat, 7 May 2016 22:19:55 +0200 Subject: [PATCH] PlayerDrawer.java added. --- cicaprojekt/PlayerDrawer.java | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 cicaprojekt/PlayerDrawer.java diff --git a/cicaprojekt/PlayerDrawer.java b/cicaprojekt/PlayerDrawer.java new file mode 100644 index 0000000..e88da0a --- /dev/null +++ b/cicaprojekt/PlayerDrawer.java @@ -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(); + } + +}