/** @param player The value determines the player to be added to the game */ private void addPlayer(Player player) { playerHashMap.put(player.getPlayerId(), player); player.setPosition(go); ClientOperator clientOperator = new ClientOperator(serverOperator); serverOperator.addDestination(player, clientOperator); actions.put(player.getPlayerId(), new HashMap<String, ActionThread>()); }
private void Render() { BufferStrategy BS = getBufferStrategy(); if (BS == null) { bimg = new BufferedImage(Width, Height, BufferedImage.TYPE_INT_RGB); screen.setPixels(((DataBufferInt) bimg.getRaster().getDataBuffer()).getData()); createBufferStrategy(3); screen.setWHP(Width, Height, screen.getPixels()); return; } screen.clearPixels(); screen.Render(); player.Render(); ObjectList.Render(); Graphics g = BS.getDrawGraphics(); g.drawImage(bimg, 0, 0, Width, Height, null); g.setColor(Color.WHITE); g.setFont(new Font("TimesRoman", Font.PLAIN, 80)); g.drawString("Score: " + Score, Width - 400, 60); g.drawString("Health: " + player.getHealth(), 0, 60); g.dispose(); BS.show(); }
private void Update() { KeyUpdate(); player.Update(); ObjectList.Update(); ObjectList.CheckCol(); }