Merge remote-tracking branch 'origin/master'
commit
99439bd4b2
|
@ -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,12 +420,16 @@ 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 (leftClickPlacedSteel) {
|
||||||
|
leftClickPlacedSteel = false;
|
||||||
|
} else {
|
||||||
if (GameFrame.game.bombs.size() < 2 && LevelManager.bombs > 0 && !holdingSteel) {
|
if (GameFrame.game.bombs.size() < 2 && LevelManager.bombs > 0 && !holdingSteel) {
|
||||||
LevelManager.bombs--;
|
LevelManager.bombs--;
|
||||||
GameFrame.game.bombs.add(new StickyBomb(GameFrame.game.player.x + GameFrame.game.camera.x + WIDTH / 2, GameFrame.game.player.y + HEIGHT / 2,
|
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));
|
(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){
|
||||||
rightMouseDown = false;
|
rightMouseDown = false;
|
||||||
|
|
||||||
|
|
|
@ -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