added first level
parent
ab3998c77c
commit
a086ac65ae
|
@ -1,18 +1,18 @@
|
|||
wwwwwwwwwwwwwwwwwe
|
||||
sssssssssssssssssd
|
||||
sssssssssssssssssd 1
|
||||
sssssssssssssssssd
|
||||
sssssssssssssssssd
|
||||
sssssssssssssssssd 1 1lllllllll1 1 1
|
||||
sssssssssssssssssd 1
|
||||
sssssssssssssssssd
|
||||
qe qe
|
||||
u qwe ad ! ad qre
|
||||
h k a d qwe qwe atwwwrd qwwwwwwellllqwwwwwwwe ad
|
||||
sssssssssssssssssd m zxc asd asd zxxxxxc zxxxxxxxllllxxxxxxxxc ad
|
||||
sssssssssssssssssd 1 zxc zxc vvvvvvvvwwwwvvvvvvvvv ad
|
||||
sssssssssssssssssd qe vvvvvvvvvvvvvvvvvvvvv ad
|
||||
sssssssssssssssssdlllllad 2 qwwwwwwwwe vvvvvvvvvvvvvvvvvvvvv ad
|
||||
sssssssssssssssssdlllllad bbb s qrsssslssstwe vvvvvvvvvvvvvvvvvvvvv ad
|
||||
sssssssssssssssssdllllladbb s ooqwwrssssllssssstwe ! b h !!! qwek vvvvvvvvvvvvvvvvvvvvv + ad
|
||||
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrsssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3
|
||||
wwwwwwwwwwwwwwwwwe qwwwwwwwwwwwwwwwwe +wwwwwwwwwwwwwwe
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd assssssssssssssssd +ssssssssssssssd
|
||||
sssssssssssssssssd asssssssssssssssstwwwwwwwwwwwe +ssssssssssssssd
|
||||
sssssssssssssssssd zxxxxxxxxxxxxxxxxxxxxxxxxxxxftwwwwwwe qe +ssssssssssssssd
|
||||
sssssssssssssssssd bb zxxxxxxxcooad h +ssssssssssssssd
|
||||
sssssssssssssssssd qe q e bb ad +ssssssssssssssd
|
||||
sssssssssssssssssd ad qwwwrlllte bb ad +ssssssssssssssd
|
||||
sssssssssssssssssd ad asssssssste bb ad +ssssssssssssssd
|
||||
sssssssssssssssssd ad ! qwrssssssssstwwwe bb ad h +ssssssssssssssd
|
||||
ssssssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrtwwwwwwwwwwwwwwwwrsssssssssssssstwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwd
|
||||
|
|
Binary file not shown.
|
@ -350,7 +350,6 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
// throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
g.drawString(player.xVelocity+"",400,400);
|
||||
}
|
||||
|
||||
//call the move methods in other classes to update positions
|
||||
|
@ -424,6 +423,11 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
} else {
|
||||
LevelManager.bombs = bombCount;
|
||||
}
|
||||
try {
|
||||
player.resetNoSound();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//the CPU runs our game code too quickly - we need to slow it down! The following lines of code "force" the computer to get stuck in a loop for short intervals between calling other methods to update the screen.
|
||||
long lastTime = System.nanoTime();
|
||||
double amountOfTicks = 60;
|
||||
|
@ -451,7 +455,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
}
|
||||
checkCollision();
|
||||
updateEnemy();
|
||||
if(fireballCounter<0){fireballCounter = 100;}
|
||||
if(fireballCounter<0){fireballCounter = 200;}
|
||||
fireballCounter--;
|
||||
if(fireballCounter == 0){
|
||||
updateShootingBlock();
|
||||
|
@ -541,7 +545,11 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
waitForDialogue = false;
|
||||
}
|
||||
} else {
|
||||
player.keyPressed(e);
|
||||
try {
|
||||
player.keyPressed(e);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class GenericSprite extends Rectangle implements Serializable {
|
|||
//called from GamePanel when any keyboard input is detected
|
||||
//updates the direction of the ball based on user input
|
||||
//if the keyboard input isn't any of the options (d, a, w, s), then nothing happens
|
||||
public void keyPressed(KeyEvent e){
|
||||
public void keyPressed(KeyEvent e) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.Arrays;
|
|||
|
||||
public class LevelManager implements Serializable {
|
||||
public static int level = 1;
|
||||
public static int xSpawn = 0;
|
||||
public static int ySpawn = 600;
|
||||
public static int xSpawn = -400;
|
||||
public static int ySpawn = 500;
|
||||
|
||||
public static String filePath;
|
||||
|
||||
|
@ -21,8 +21,9 @@ public class LevelManager implements Serializable {
|
|||
GameFrame.game.player.xVelocity = 0;
|
||||
LevelManager.level = level;
|
||||
if(level == 1){
|
||||
xSpawn = 0;
|
||||
ySpawn = 300;
|
||||
//-400/500
|
||||
xSpawn = -400;
|
||||
ySpawn = 500;
|
||||
filePath = "saves/Level1.txt";
|
||||
bombs = 99999;
|
||||
} else if(level == 2){
|
||||
|
|
|
@ -61,7 +61,7 @@ public class Player extends GenericSprite {
|
|||
|
||||
|
||||
// moves paddle when key is pressed
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e) throws IOException {
|
||||
if(e.getKeyCode() == KeyEvent.VK_D){
|
||||
rightPressed = true;
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ public class Player extends GenericSprite {
|
|||
if(e.getKeyCode() == KeyEvent.VK_S){
|
||||
downPressed = true;
|
||||
}
|
||||
if(e.getKeyCode() == KeyEvent.VK_R){
|
||||
resetNoSound();
|
||||
}
|
||||
}
|
||||
|
||||
// stops moving paddle when key is released
|
||||
|
@ -105,6 +108,9 @@ public class Player extends GenericSprite {
|
|||
// calls parent
|
||||
|
||||
public boolean canUpdate(double x, double y) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
||||
if(this.y+y<=-HEIGHT){
|
||||
return false;
|
||||
}
|
||||
boolean canUpdate = true;
|
||||
int lowX = Math.max(0, ((GameFrame.game.camera.x+GamePanel.GAME_WIDTH)/Tile.length)-4);
|
||||
int highX = Math.min(lowX + 8, GameFrame.game.map.length);
|
||||
|
@ -129,6 +135,7 @@ public class Player extends GenericSprite {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return canUpdate;
|
||||
}
|
||||
|
||||
|
@ -186,6 +193,7 @@ public class Player extends GenericSprite {
|
|||
public void move() throws IOException, UnsupportedAudioFileException, LineUnavailableException {
|
||||
// mouseX = MouseInfo.getPointerInfo().getLocation().x;
|
||||
// mouseY = MouseInfo.getPointerInfo().getLocation().y;
|
||||
|
||||
pickupDelay = Math.max(0,pickupDelay - 1);
|
||||
int Tilex = (mouseX + GameFrame.game.camera.x + GamePanel.GAME_WIDTH / 2) / Tile.length;
|
||||
int Tiley = (mouseY / Tile.length);
|
||||
|
@ -279,6 +287,7 @@ public class Player extends GenericSprite {
|
|||
reset();
|
||||
}
|
||||
capSpeed();
|
||||
|
||||
}
|
||||
|
||||
public void reset() throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
||||
|
@ -288,7 +297,7 @@ public class Player extends GenericSprite {
|
|||
y = LevelManager.ySpawn;
|
||||
holdingSteel = false;
|
||||
}
|
||||
public void resetNoSound() throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
||||
public void resetNoSound() throws IOException {
|
||||
LevelManager.setLevel(LevelManager.level, true);
|
||||
GameFrame.game.camera.x = LevelManager.xSpawn;
|
||||
y = LevelManager.ySpawn;
|
||||
|
|
|
@ -1,11 +1,29 @@
|
|||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
import java.io.*;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.Clip;
|
||||
import javax.swing.*;
|
||||
|
||||
public class SoundWrapper implements Serializable {
|
||||
transient public Sound sound;
|
||||
public String soundString;
|
||||
|
||||
public static Sound grass;
|
||||
|
||||
static {
|
||||
try {
|
||||
grass = new Sound("sound/grass.wav");
|
||||
} catch (UnsupportedAudioFileException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (LineUnavailableException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// please note that not as many constructors were implemented as BufferedImage, as this class was created before most sounds were added;
|
||||
// as such, backwards compatibility was not needed
|
||||
public SoundWrapper(String soundLocation) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
||||
|
@ -37,4 +55,5 @@ public class SoundWrapper implements Serializable {
|
|||
}
|
||||
sound.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue