Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BoardPanel extends JPanel {
- public void paint(Graphics g) {
- super.paint(g);
- for (int y = 0; y < 8; y++) {
- for (int x = 0; x < 8; x++) {
- if (gameMap.getMap(x, y).equals("h")) {
- g.drawImage(gameImage.getHoney(), x * 50, y * 50, null);
- }
- if (gameMap.getMap(x, y).equals("g")) {
- g.drawImage(gameImage.getGrass(), x * 50, y * 50, null);
- }
- if (gameMap.getMap(x, y).equals("r")) {
- g.drawImage(gameImage.getRock(), x * 50, y * 50, null);
- }
- if (gameMap.getMap(x, y).equals("q")) {
- g.drawImage(gameImage.getQuestion(), x * 50, y * 50, null);
- }
- }
- }
- g.drawImage(gameImage.getBear(), bear.getTitleX() * 50, bear.getTitleY() * 50, null);
- }
- // vẽ lại map với toạ độ đã thay đổi
- public void updateBoard() {
- repaint();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement