level 7
This commit is contained in:
@@ -355,6 +355,17 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
this.setBackground(SKY);
|
||||
}
|
||||
|
||||
if (currentLevel == 8) {
|
||||
// draw black overlay over entire world
|
||||
g.setColor(new Color(0, 0, 0, 255));
|
||||
g.fillRect(cameraX, cameraY, boardWidth, boardHeight);
|
||||
// cut out a circle around the player
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR));
|
||||
g2.fillOval(player.x - 60, player.y - 60, 120, 120);
|
||||
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
|
||||
}
|
||||
|
||||
g.translate(-cameraX, -cameraY);
|
||||
|
||||
player.draw(g);
|
||||
|
||||
Reference in New Issue
Block a user