Merge remote-tracking branch 'origin/master'
commit
99439bd4b2
|
@ -80,4 +80,4 @@ public class GameFrame extends JFrame{
|
||||||
this.setLocationRelativeTo(null);//set window in middle of screen
|
this.setLocationRelativeTo(null);//set window in middle of screen
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,4 +602,4 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
||||||
return flippedImage;
|
return flippedImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,4 +116,4 @@ public class GenericSprite extends Rectangle implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@ class Main {
|
||||||
new GameFrame();
|
new GameFrame();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,4 +204,4 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,4 +101,4 @@ public class NonPlayer extends GenericSprite implements Serializable {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ public class Player extends GenericSprite {
|
||||||
// sA[2] is -x, y
|
// sA[2] is -x, y
|
||||||
// sA[3] is x, y
|
// sA[3] is x, y
|
||||||
public BufferedImageWrapper[][][] spriteArray;
|
public BufferedImageWrapper[][][] spriteArray;
|
||||||
|
public boolean leftClickPlacedSteel;
|
||||||
|
|
||||||
public Player(int x, int y, BufferedImageWrapper[][][] sprites) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
public Player(int x, int y, BufferedImageWrapper[][][] sprites) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
||||||
super(x, y, PLAYER_HEIGHT, PLAYER_WIDTH);
|
super(x, y, PLAYER_HEIGHT, PLAYER_WIDTH);
|
||||||
// jump = new Sound("sound/jump.wav");
|
// jump = new Sound("sound/jump.wav");
|
||||||
|
@ -306,13 +308,17 @@ public class Player extends GenericSprite {
|
||||||
mouseX = e.getX();
|
mouseX = e.getX();
|
||||||
mouseY = e.getY();
|
mouseY = e.getY();
|
||||||
if(e.getButton()==MouseEvent.BUTTON1) {
|
if(e.getButton()==MouseEvent.BUTTON1) {
|
||||||
leftMouseDown = true;
|
int x = (mouseX + GameFrame.game.camera.x + GamePanel.GAME_WIDTH / 2) / Tile.length;
|
||||||
|
int y = (mouseY / Tile.length);
|
||||||
if (holdingSteel && ((GameFrame.game.map[x][y] == null || GameFrame.game.map[x][y].replaceAble) && canPlaceSteel)) {
|
if (holdingSteel && ((GameFrame.game.map[x][y] == null || GameFrame.game.map[x][y].replaceAble) && canPlaceSteel)) {
|
||||||
Tile temp = GameFrame.game.map[x][y];
|
Tile temp = GameFrame.game.map[x][y];
|
||||||
GameFrame.game.map[x][y] = new SingleTile(x * Tile.length - (GamePanel.GAME_WIDTH / 2), y * Tile.length, new BufferedImageWrapper(("img/tiles/boxes/steel.png")));
|
GameFrame.game.map[x][y] = new SingleTile(x * Tile.length - (GamePanel.GAME_WIDTH / 2), y * Tile.length, new BufferedImageWrapper(("img/tiles/boxes/steel.png")));
|
||||||
GameFrame.game.map[x][y].movable = true;
|
GameFrame.game.map[x][y].movable = true;
|
||||||
GameFrame.game.map[x][y].previousBlock = temp;
|
GameFrame.game.map[x][y].previousBlock = temp;
|
||||||
holdingSteel = false;
|
holdingSteel = false;
|
||||||
|
leftClickPlacedSteel = true;
|
||||||
|
} else {
|
||||||
|
leftMouseDown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.getButton()==MouseEvent.BUTTON3) {
|
if(e.getButton()==MouseEvent.BUTTON3) {
|
||||||
|
@ -414,10 +420,14 @@ public class Player extends GenericSprite {
|
||||||
mouseY = e.getY();
|
mouseY = e.getY();
|
||||||
if(e.getButton()==MouseEvent.BUTTON1) {
|
if(e.getButton()==MouseEvent.BUTTON1) {
|
||||||
leftMouseDown = false;
|
leftMouseDown = false;
|
||||||
if (GameFrame.game.bombs.size() < 2 && LevelManager.bombs>0 && !holdingSteel) {
|
if (leftClickPlacedSteel) {
|
||||||
LevelManager.bombs--;
|
leftClickPlacedSteel = false;
|
||||||
GameFrame.game.bombs.add(new StickyBomb(GameFrame.game.player.x + GameFrame.game.camera.x + WIDTH/2, GameFrame.game.player.y+HEIGHT/2,
|
} else {
|
||||||
(mouseX - GameFrame.game.player.x) / 20, (mouseY - GameFrame.game.player.y) / 10, GameFrame.game.bomb, GameFrame.game.explosionArray));
|
if (GameFrame.game.bombs.size() < 2 && LevelManager.bombs > 0 && !holdingSteel) {
|
||||||
|
LevelManager.bombs--;
|
||||||
|
GameFrame.game.bombs.add(new StickyBomb(GameFrame.game.player.x + GameFrame.game.camera.x + WIDTH / 2, GameFrame.game.player.y + HEIGHT / 2,
|
||||||
|
(mouseX - GameFrame.game.player.x) / 20, (mouseY - GameFrame.game.player.y) / 10, GameFrame.game.bomb, GameFrame.game.explosionArray));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.getButton()==MouseEvent.BUTTON3){
|
if(e.getButton()==MouseEvent.BUTTON3){
|
||||||
|
@ -451,4 +461,4 @@ public class Player extends GenericSprite {
|
||||||
}
|
}
|
||||||
|
|
||||||
//public int BfsDis()
|
//public int BfsDis()
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,4 +142,4 @@ public class SettingPanel extends MenuPanel {
|
||||||
currentBox = UtilityFunction.processBox(e, currentBox, textBoxArray);
|
currentBox = UtilityFunction.processBox(e, currentBox, textBoxArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,5 @@ public class WallSign extends TextBox implements Serializable {
|
||||||
newX -= GameFrame.game.camera.x;
|
newX -= GameFrame.game.camera.x;
|
||||||
super.draw(g, new Color(0, 0, 0, 0), textColor);
|
super.draw(g, new Color(0, 0, 0, 0), textColor);
|
||||||
newX = oldX;
|
newX = oldX;
|
||||||
System.out.println();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue