Mer
parent
5c5ccc5188
commit
64f99d66b0
|
@ -207,9 +207,11 @@ public class Player extends GenericSprite {
|
|||
public void mousePressed(MouseEvent e) {
|
||||
int xx = e.getX();
|
||||
int yy = e.getY();
|
||||
GamePanel.bombs.add(new StickyBomb(GamePanel.player.x+GamePanel.camera.x,GamePanel.player.y,35,
|
||||
if (GamePanel.bombs.size() < 3) {
|
||||
GamePanel.bombs.add(new StickyBomb(GamePanel.player.x + GamePanel.camera.x, GamePanel.player.y, 25,
|
||||
(xx - GamePanel.player.x) / 20, (yy - GamePanel.player.y) / 10, GamePanel.bomb, GamePanel.explosionArray));
|
||||
}
|
||||
}
|
||||
public void addParticle(int x) throws IOException {
|
||||
if(GlobalState.randInt(1,3)==3) {
|
||||
GamePanel.particles.add(new Particle(this.x + GamePanel.camera.x + WIDTH / 2 + GlobalState.randInt(-PLAYER_WIDTH / 2, PLAYER_WIDTH / 2)
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.awt.image.BufferedImage;
|
|||
|
||||
public class StickyBomb extends GenericSprite{
|
||||
public int length;
|
||||
|
||||
public static final int spriteLength = 35;
|
||||
public int xVelocity;
|
||||
public int yVelocity;
|
||||
public boolean isMove;
|
||||
|
@ -60,6 +62,7 @@ public class StickyBomb extends GenericSprite{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void move(){
|
||||
update();
|
||||
if(fuse>0) {
|
||||
|
@ -121,10 +124,10 @@ public class StickyBomb extends GenericSprite{
|
|||
explosionCounter -= 2;
|
||||
}
|
||||
if(alive) {
|
||||
g.drawImage(sprite, x - GamePanel.camera.x, y, length, length, null);
|
||||
g.drawImage(sprite, x - GamePanel.camera.x - (spriteLength-length)/2, y - (spriteLength-length)/2, spriteLength, spriteLength, null);
|
||||
} else if (explosionPixel < explosionSpriteArray.length - 1) {
|
||||
g.drawImage(explosionSpriteArray[explosionPixel], x - GamePanel.camera.x - 10*explosionPixel,
|
||||
y-10*explosionPixel, length+10*explosionPixel, length+10*explosionPixel, null);
|
||||
y-10*explosionPixel, spriteLength+10*explosionPixel, spriteLength+10*explosionPixel, null);
|
||||
explosionCounter += 1;
|
||||
} else {
|
||||
erase = true;
|
||||
|
|
Loading…
Reference in New Issue