Fix deprecated keyevent, fix access error, center stickybomb explosion
parent
ab3998c77c
commit
ef95740a7b
|
@ -35,10 +35,18 @@ public class FileManager {
|
|||
} else {
|
||||
objectStream = new ObjectInputStream(fileStream);
|
||||
}
|
||||
o = objectStream.readObject();
|
||||
try {
|
||||
o = objectStream.readObject();
|
||||
} catch (Exception e) {
|
||||
// please note that the broad exception Exception was used here
|
||||
// as in the event of any exception, the object should still be closed
|
||||
// additionally, the exception is reraised, so no information is lost from being too coarse
|
||||
objectStream.close();
|
||||
fileStream.close();
|
||||
throw e;
|
||||
}
|
||||
objectStream.close();
|
||||
fileStream.close();
|
||||
System.out.println("done");
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
try {
|
||||
if (isDialogue || isPaused) {
|
||||
mouseAlreadyTranslated = true;
|
||||
keyPressed(new KeyEvent(new Component() {}, 0, 0, 0, KeyEvent.VK_ENTER));
|
||||
keyPressed(new KeyEvent(new Component() {}, 0, 0, 0, KeyEvent.VK_ENTER, (char)KeyEvent.VK_ENTER));
|
||||
} else {
|
||||
player.mousePressed(e);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
|||
public void mousePressed(MouseEvent e) {
|
||||
if (hoverCheck(e)) {
|
||||
keyPressed(new KeyEvent(new Component() {
|
||||
}, 0, 0, 0, KeyEvent.VK_ENTER));
|
||||
}, 0, 0, 0, KeyEvent.VK_ENTER, (char)KeyEvent.VK_ENTER));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -214,7 +214,8 @@ public class StickyBomb extends GenericSprite implements Serializable {
|
|||
g.drawImage(sprite.image, x - GameFrame.game.camera.x - (spriteLength-length)/2, y - (spriteLength-length)/2, spriteLength, spriteLength, null);
|
||||
//g.drawRect(x-GameFrame.game.camera.x,y,length,length);
|
||||
} else if (explosionPixel < explosionSpriteArray.length - 1) {
|
||||
g.drawImage(explosionSpriteArray[explosionPixel].image, x - GameFrame.game.camera.x - 10*explosionPixel,
|
||||
// please note that the explosion is completely centered on the x plane ("5*") but tends upwards on the y plane ("10*")
|
||||
g.drawImage(explosionSpriteArray[explosionPixel].image, x - GameFrame.game.camera.x - 5*explosionPixel,
|
||||
y-10*explosionPixel, spriteLength+10*explosionPixel, spriteLength+10*explosionPixel, null);
|
||||
explosionCounter += 1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue