This commit is contained in:
2026-04-20 01:48:29 -05:00
parent 3b7869be34
commit 1bfe32fb09
3 changed files with 34 additions and 21 deletions

View File

@@ -8,13 +8,13 @@
.................................................................................................................. ..................................................................................................................
.................................................................................................................. ..................................................................................................................
.................................................................................................................. ..................................................................................................................
.................................................................................................................. ..........................................................................................................A........
.................................................................................................................. ....................................................................................................BBBBBBBBB..............
.................................................................................................................. .................................................................A.................................................
.................................................................................................................. ............................................................BBBBBBBBB......................................................
.................................................................................................................. ..................................................E...A....................................................BBBBBBBBBBB.........
.................................................................................................................. .............................................BBBBBBBBBBBB...................................BBBBBB..................................
..P............................................................................................................... ..P......................................EE..............................AE..........................................
.................................................................................................................. .............................E.....BBBBBBBBB...........................BBBBBBB.........................................BBBBBBB...........
.................................................................................................................. .......................A...BBBBBB....................................................BBBBBBB...............................................F
BBBBBBBBBB.....BBBBBB............................................................................................................. BBBBBBBBBB.....BBBBBB..BBBBBBBBBB...................................................................................................BBBBBBBBBBBBBB........

Binary file not shown.

View File

@@ -1,5 +1,6 @@
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.image.*;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -355,17 +356,6 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
this.setBackground(SKY); 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); g.translate(-cameraX, -cameraY);
player.draw(g); player.draw(g);
@@ -403,6 +393,29 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
g.translate(cameraX, cameraY); g.translate(cameraX, cameraY);
if (currentLevel == 8) {
BufferedImage darkness =
new BufferedImage(boardWidth, boardHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = darkness.createGraphics();
// fill entire overlay with fully opaque black
g2.setColor(new Color(0, 0, 0, 255));
g2.fillRect(0, 0, boardWidth + 1000, boardHeight + 1000);
// player's position in screen coordinates
int screenX = (player.x + player.width / 2) - cameraX;
int screenY = (player.y + player.height / 2) - cameraY;
// cut circle centered on player
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR));
g2.fillOval(screenX - 80, screenY - 100, 160, 160);
g2.dispose();
// draw overlay in screen space (after translate reset)
g.drawImage(darkness, 0, 0, null);
}
int modAmt = 2000; int modAmt = 2000;
int curTime = (int) System.currentTimeMillis() % modAmt; int curTime = (int) System.currentTimeMillis() % modAmt;
curTime = Math.abs(curTime); curTime = Math.abs(curTime);