This commit is contained in:
2026-04-20 01:35:46 -05:00
parent 0606be1d06
commit 3b7869be34
7 changed files with 36 additions and 9 deletions

BIN
InvisibleTile.class Normal file

Binary file not shown.

13
InvisibleTile.java Normal file
View File

@@ -0,0 +1,13 @@
import java.awt.Graphics;
import javax.swing.ImageIcon;
public class InvisibleTile extends Tile {
public InvisibleTile(int x, int y, int w, int h) {
super(x, y, w, h, new ImageIcon("Sprites/Bricks/Brick.png"));
}
@Override
public void draw(Graphics g) {
// draw nothing
}
}

Binary file not shown.

View File

@@ -50,6 +50,9 @@ public class LevelLoader {
case 'E':
enemies.add(new Enemy(x, y, enemyWidth[level], enemyHeight[level], level));
break;
case 'X':
collidables.add(new InvisibleTile(x, y, tileSize, tileSize));
break;
}
}
row++;

View File

@@ -9,12 +9,12 @@
..................................................................................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
..................................................................................................................
..P...............................................................................................................
..................................................................................................................
..................................................................................................................
..............................................................A...........................................................E
...........................................................BBBBBBBBB.......................A...........................EBBBBBBBBB...
........................................................................................BBBBBBB.....................E.BBBBBBBBBBB...
...................................................................................................................EBBBBBBBBBBBBB
............................................................................E...................................E.BBBBBBBBBBBBBBB
..P........................Q..................EEE.........................BBBBBBB...............................BBBBBBBBBBBBBBBBB.........F
..........................................BBBBBBBBBBBB..................................................BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB......................
........E........A......BBBBBBBBB..........................................................................................
BBBBBBBBBB.....BBBBBB.............................................................................................................

Binary file not shown.

View File

@@ -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);