public void paintComponent(Graphics2D g) { super.paint(g); Tile.paintMap(g); Player.draw(g); GamePlayer.paintPlayers(g); Item.paint(g); }
public Game() { super("Game"); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setSize(width, height); this.setVisible(true); this.addKeyListener(this); this.addMouseMotionListener(this); this.setLocationRelativeTo(null); this.addMouseListener(this); new repaint().start(); new GameController().start(); new MotionHandler().start(); new Multiplayer(); Item.addItem("grass", 10); Item.addItem("tree", 10); // this.setComponentOrientation(null); }
@Override public void mousePressed(MouseEvent e) { Item.action(e.getX() - Player.xCam, e.getY() - Player.yCam); }