level 7
This commit is contained in:
BIN
InvisibleTile.class
Normal file
BIN
InvisibleTile.class
Normal file
Binary file not shown.
13
InvisibleTile.java
Normal file
13
InvisibleTile.java
Normal 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.
@@ -18,7 +18,7 @@ public class LevelLoader {
|
|||||||
collectables.clear();
|
collectables.clear();
|
||||||
enemies.clear();
|
enemies.clear();
|
||||||
|
|
||||||
/*left wall*/ collidables.add(new Brick(-20, 0, 20, 2000));
|
/* left wall */ collidables.add(new Brick(-20, 0, 20, 2000));
|
||||||
|
|
||||||
BufferedReader br = new BufferedReader(new FileReader("Levels/level" + level + ".txt"));
|
BufferedReader br = new BufferedReader(new FileReader("Levels/level" + level + ".txt"));
|
||||||
String line;
|
String line;
|
||||||
@@ -50,6 +50,9 @@ public class LevelLoader {
|
|||||||
case 'E':
|
case 'E':
|
||||||
enemies.add(new Enemy(x, y, enemyWidth[level], enemyHeight[level], level));
|
enemies.add(new Enemy(x, y, enemyWidth[level], enemyHeight[level], level));
|
||||||
break;
|
break;
|
||||||
|
case 'X':
|
||||||
|
collidables.add(new InvisibleTile(x, y, tileSize, tileSize));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
row++;
|
row++;
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
..................................................................................................................
|
..................................................................................................................
|
||||||
..................................................................................................................
|
..................................................................................................................
|
||||||
..................................................................................................................
|
..................................................................................................................
|
||||||
..................................................................................................................
|
..............................................................A...........................................................E
|
||||||
..................................................................................................................
|
...........................................................BBBBBBBBB.......................A...........................EBBBBBBBBB...
|
||||||
..................................................................................................................
|
........................................................................................BBBBBBB.....................E.BBBBBBBBBBB...
|
||||||
..................................................................................................................
|
...................................................................................................................EBBBBBBBBBBBBB
|
||||||
..................................................................................................................
|
............................................................................E...................................E.BBBBBBBBBBBBBBB
|
||||||
..P...............................................................................................................
|
..P........................Q..................EEE.........................BBBBBBB...............................BBBBBBBBBBBBBBBBB.........F
|
||||||
..................................................................................................................
|
..........................................BBBBBBBBBBBB..................................................BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB......................
|
||||||
..................................................................................................................
|
........E........A......BBBBBBBBB..........................................................................................
|
||||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||||
|
|||||||
BIN
Platformer.class
BIN
Platformer.class
Binary file not shown.
@@ -355,6 +355,17 @@ 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);
|
||||||
|
|||||||
Reference in New Issue
Block a user