Push fix
parent
69e18a53a8
commit
5f9491b2ef
BIN
sound/pen-2.wav
BIN
sound/pen-2.wav
Binary file not shown.
|
@ -45,7 +45,7 @@ public class LevelManager implements Serializable {
|
|||
xSpawn = -1100;
|
||||
ySpawn = 460;
|
||||
filePath = "saves/Level4.txt";
|
||||
bombs = 5;
|
||||
bombs = 6;
|
||||
} else if(level == 5){
|
||||
//-1100/460
|
||||
xSpawn = -1100;
|
||||
|
@ -105,8 +105,6 @@ public class LevelManager implements Serializable {
|
|||
} catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//GamePanel.player.reset();
|
||||
//System.out.println("done111");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
// Eric Li, Charlie Zhao, ICS4U, Finished 5/30/2022
|
||||
/* Main class starts the game
|
||||
All it does is run the constructor in GameFrame class
|
||||
/* Main class starts the game, suppresses all output to console
|
||||
This also runs the constructor in GameFrame class
|
||||
|
||||
This is a common technique among coders to keep things organized (and handy when coding in repl.it since we're forced to call a class Main, which isn't always very descriptive)
|
||||
*/
|
||||
*/
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.setOut(new PrintStream(new OutputStream() {
|
||||
public void write(int b) {
|
||||
// does nothing
|
||||
}
|
||||
}));
|
||||
|
||||
new GameFrame();
|
||||
|
||||
}
|
||||
|
|
|
@ -182,6 +182,9 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
|||
// if the user presses "New Game", reset GamePanel and navigate to it
|
||||
if (textBoxArray.get(currentBox).id.equals("game-start")) {
|
||||
try {
|
||||
// temporary variable so was not declared earlier
|
||||
// save middleware array to re-add after game is created again
|
||||
ArrayList<Middleware> oldMiddlewareArray = (ArrayList<Middleware>)GameFrame.game.middlewareArray.clone();
|
||||
// remove the old GamePanel from the CardLayout CameraPanel
|
||||
GameFrame.main.remove(GameFrame.game);
|
||||
// stop the run() while loop, effectively killing the thread
|
||||
|
@ -192,6 +195,8 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
|||
// reset the tile map to prevent race conditions
|
||||
GameFrame.game.map = new Tile[1000][18];
|
||||
GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor
|
||||
// readd middleware array
|
||||
GameFrame.game.middlewareArray = oldMiddlewareArray;
|
||||
// make it so that the game can be resumed if the player leaves
|
||||
GameFrame.game.isContinue = true;
|
||||
textBoxArray.add(continueGame);
|
||||
|
|
|
@ -203,7 +203,7 @@ public class Player extends GenericSprite {
|
|||
if(GameFrame.game.map[x][y]!=null&&!GameFrame.game.map[x][y].replaceAble){canPlaceSteel = false; return;}
|
||||
|
||||
//If you can't reach an area because of blocks in the way, you can't place.
|
||||
if(!canReach(xx,yy)){canPlaceSteel = false; return;};
|
||||
if(!canReach(xx,yy)){canPlaceSteel = false;}
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,7 +220,7 @@ public class Player extends GenericSprite {
|
|||
}
|
||||
//Stops player from glitching into corner
|
||||
if(canUpdate(xVelocity, 0)&&canUpdate(0, yVelocity)&&!canUpdate(xVelocity, yVelocity)){
|
||||
GameFrame.game.camera.x += -Math.signum(xVelocity);
|
||||
GameFrame.game.camera.x -= Math.signum(xVelocity);
|
||||
}
|
||||
|
||||
//Prevents player from passing tiles in the x-direction
|
||||
|
@ -434,16 +434,10 @@ public class Player extends GenericSprite {
|
|||
yy.add(newY);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
if (dis[x][y] <= 6) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return dis[x][y] <= 6;
|
||||
}catch(Exception e){
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Press P to skip to the next level.
|
||||
Delete local/game_state if you bound the wrong controls and are not having a good time.
|
||||
Use bombs sparingly.
|
||||
Use bombs sparingly.
|
||||
The game is fairly computationally expensive, so there may be five-second pauses when the game is rendering more tiles; if this happens, don't quit the game.
|
Loading…
Reference in New Issue