level 4
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
.................................
|
||||
.................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P...............................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
..................................................................................................................
|
||||
..................................................................................................
|
||||
..................................................................................................
|
||||
..................................................................................................
|
||||
....................Q.............................................................................
|
||||
..................................................................................................
|
||||
....................A.............................................................................
|
||||
...................BBBBB..........................................................................
|
||||
.................................BBBBB....................Q......................................
|
||||
...................BBBBB.........................................................................
|
||||
.
|
||||
.
|
||||
.................................BBBBB
|
||||
..........................................................
|
||||
.................................................A................................................
|
||||
..............................................BBBBBBBB....................................................
|
||||
..........................................................BBBBB........................................
|
||||
..............................................BBBBBBBB..
|
||||
.
|
||||
..................................................
|
||||
..........................................................BBBBB..
|
||||
......................................
|
||||
.....................................................................BBBBBBBBBB....A............................A
|
||||
..................................................................................BBBBB.....BBBBB............BBBBBBB.........E....................
|
||||
.......................................................................................................................BBBBBBBB........................................
|
||||
.....................................................................................................A...................................................................
|
||||
....................................................................................................BBBBBB...........................A...........................
|
||||
...............................................................A.................................................................BBBBBBBB..............................
|
||||
.................................................................................................................................BBBBBBBB........
|
||||
...............................................................A
|
||||
..P...................A..................BBBQBBBBB............BBBBBBBB.................BBBQBBBB....................................................................
|
||||
...............................................................................................................................................................
|
||||
..............................................................................................
|
||||
.................................................................
|
||||
...............E.............A..............................................A........................................................................F......
|
||||
BBBBBBBB......BBBBBBBBBB....BBBBB...BBBBBBBBBBBBB........................BBBBBBBBBB.......BB................................................BBBBBBBBBB
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
.................................
|
||||
.................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBBB..................................................................................................................
|
||||
..................................................................................................................
|
||||
....
|
||||
....B.........................................B
|
||||
....B.........................................B......................
|
||||
....B.........................................B....................................................................
|
||||
....B.........................................B....................................................................
|
||||
....B.........................................B.....................................................................
|
||||
....BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB..............................................................................................................
|
||||
................................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................
|
||||
..................................................................................................................
|
||||
...................AAAAAAAAAAAAAAAAAA..........................F............................................
|
||||
.................BBBBBBBBBBBBBBBBBBBBBBB.....BBBBBBBBBBBBBBBBBBBBB............................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
.................................
|
||||
.................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P...............................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
.................................
|
||||
.................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P...............................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
.................................
|
||||
.................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P...............................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
.................................
|
||||
.................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P...............................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
.................................
|
||||
.................................
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
...P
|
||||
...............E
|
||||
BBBBBBBB..BBBBBBBBBB
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
..P...............................................................................................................
|
||||
..................................................................................................................
|
||||
..................................................................................................................
|
||||
BBBBBBBBBB.....BBBBBB.............................................................................................................
|
||||
|
||||
BIN
Platformer.class
BIN
Platformer.class
Binary file not shown.
@@ -3,6 +3,7 @@ import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
@@ -16,7 +17,7 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
static final int MAXYVELO = 15;
|
||||
static final int MAXXVELO = 5;
|
||||
static final int totalLevels = 10;
|
||||
static int[] numAm = {4, 5, 10, 0, 0, 0, 0, 0, 0, 0};
|
||||
static int[] numAm = {4, 5, 10, 18, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// game objects
|
||||
Player player;
|
||||
@@ -30,6 +31,7 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
int boardWidth;
|
||||
int boardHeight;
|
||||
int tileSize;
|
||||
int enemiesKilled;
|
||||
Timer gameTimer;
|
||||
HashMap<Integer, Boolean> pressedKeys;
|
||||
boolean jumpPressed;
|
||||
@@ -74,6 +76,7 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
cameraX = 0;
|
||||
cameraY = 0;
|
||||
currentLevel = 0;
|
||||
enemiesKilled = 0;
|
||||
numbers = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++)
|
||||
numbers.add((new ImageIcon("Sprites/Numbers/" + i + ".png")).getImage());
|
||||
@@ -104,6 +107,24 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
// gameloop
|
||||
public void gameLoop() {
|
||||
if (currentLevel > totalLevels) return;
|
||||
|
||||
// lvl 3 arena
|
||||
if (currentLevel == 4) {
|
||||
if (enemiesKilled < 100 && enemies.isEmpty()) {
|
||||
Random rand = new Random();
|
||||
int xOff = rand.nextInt(700);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
xOff = rand.nextInt(700);
|
||||
if (xOff + 80 <= player.x && player.x <= xOff + 140) xOff += 60;
|
||||
enemies.add(new Enemy(100 + xOff, 280, 20, 20, currentLevel));
|
||||
}
|
||||
|
||||
} else if (enemiesKilled >= 100) {
|
||||
collidables.removeIf(c -> c.y == 300 && c.x >= 440 && c.x <= 520);
|
||||
}
|
||||
}
|
||||
|
||||
// camera
|
||||
cameraX = player.x - boardWidth / 2;
|
||||
cameraX = Math.max(0, cameraX);
|
||||
@@ -282,6 +303,7 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
for (Enemy e : new ArrayList<>(enemies)) {
|
||||
if (p.collidesWith(e)) {
|
||||
enemies.remove(e);
|
||||
enemiesKilled++;
|
||||
projectiles.remove(p);
|
||||
break;
|
||||
}
|
||||
@@ -292,6 +314,7 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
|
||||
public void loadLevel(int level) {
|
||||
projectiles.clear();
|
||||
enemiesKilled = 0;
|
||||
try {
|
||||
LevelLoader.load(tileSize, collidables, collectables, enemies, flag, player, level);
|
||||
player.reset();
|
||||
@@ -335,6 +358,9 @@ public class Platformer extends JPanel implements KeyListener, ActionListener {
|
||||
if (currentLevel == 2) {
|
||||
g.drawString("Take a leap of faith....", flag.x - 25, flag.y - 400);
|
||||
}
|
||||
if (currentLevel == 4) {
|
||||
g.drawString("Kill 100 of them...", 220, 200);
|
||||
}
|
||||
// flag counter
|
||||
int amOnes = player.numAmendments % 10;
|
||||
int amTens = player.numAmendments / 10;
|
||||
|
||||
BIN
Player.class
BIN
Player.class
Binary file not shown.
@@ -46,6 +46,10 @@ public class Player extends Collidable {
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
if (level >= 2) {
|
||||
this.icon = new ImageIcon("Sprites/Player/2.png");
|
||||
return;
|
||||
}
|
||||
this.icon = new ImageIcon("Sprites/Player/" + level + ".png");
|
||||
}
|
||||
|
||||
|
||||
BIN
Projectile.class
BIN
Projectile.class
Binary file not shown.
@@ -4,7 +4,8 @@ public class Projectile extends Collidable {
|
||||
int xVelo;
|
||||
|
||||
public Projectile(int x, int y, int w, int h, int curLevel, int direction) {
|
||||
super(x, y, w, h, new ImageIcon("Sprites/Projectiles/" + curLevel + ".png"));
|
||||
super(
|
||||
x, y, w, h, new ImageIcon("Sprites/Projectiles/" + ((curLevel == 1) ? "1" : "2") + ".png"));
|
||||
xVelo = 10 * direction;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user