class GamePanel extends JPanel {
public void paintComponent(Graphics g) {
for (row = 0; row < board.length; row++) {
for (col = 0; col < board[row].length; col++) {
int index = board[row][col];
g.drawImage(tiles[index], 32 * col, 32 * row, this);
}
}
try {
for (Player player : players.values()) {
System.out.println("++++++++++++++++++++++++++");
System.out.println("current map: " + player.getMap());
if (player.getUsername() == me.getUsername())
player.setMap(currentMap);
if (player.getUsername() == me.getUsername())
player.setCommand(myCommand);
if (player.getMap() == currentMap) {
g.drawImage(player.getPlayerImage(), player.getX(), player
.getY(), this);
}
System.out.println("Command-- " + player.getCommand() + " > "
+ player.getUsername() + " moved to X:" + player.getX()
+ " and Y: " + player.getY());
System.out.println("++++++++++++++++++++++++++");
}
} catch (Exception dan) {
System.out.println("No one is on.");
}
// qq
/**
* for(int runx = 0;runx < 10;runx++) { g.drawImage(userImg[runx],
* userPX[runx], userPY[runx], this); }
**/
if (drawFlail == true && currentMap == 1) g.drawImage(weapon[1], 32 * 4, 32 * 4, this);
if (drawBattleaxe == true && currentMap == 1) g.drawImage(weapon[0], 32 * 3, 32 * 2, this);
if (drawSword == true && currentMap == 1) g.drawImage(weapon[2], 32 * 13, 32 * 7, this);
}
}
|