public static void RestartGame() { player = new Player(10, 200, KH); Score = 0; ObjectList.Removeall(); for (int i = 0; i < 75; i++) { ObjectList.addEnemy(new Enemy(random.nextInt(400) * 2 + 500, random.nextInt(400) * 2)); } }
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(); }