Bomb Physics

master
bob 2022-06-07 13:48:31 -04:00
parent c63246cdb9
commit 0aa3cff3e8
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
//add the MousePressed method from the MouseAdapter - by doing this we can listen for mouse input. We do this differently from the KeyListener because MouseAdapter has SEVEN mandatory methods - we only need one of them, and we don't want to make 6 empty methods //add the MousePressed method from the MouseAdapter - by doing this we can listen for mouse input. We do this differently from the KeyListener because MouseAdapter has SEVEN mandatory methods - we only need one of them, and we don't want to make 6 empty methods
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
player.mousePressed(e); //player.mousePressed(e);
} }
}); });
this.setPreferredSize(new Dimension(GAME_WIDTH, GAME_HEIGHT)); this.setPreferredSize(new Dimension(GAME_WIDTH, GAME_HEIGHT));

View File

@ -74,7 +74,7 @@ public class StickyBomb extends GenericSprite{
public void mousePressed(MouseEvent e){ public void mousePressed(MouseEvent e){
int xx = e.getX(); int xx = e.getX();
int yy = e.getY(); int yy = e.getY();
GamePanel.b = new StickyBomb(GamePanel.player.x+GamePanel.camera.x,GamePanel.player.y,35, (xx-GamePanel.player.x-GamePanel.camera.x)/20, (yy-GamePanel.player.y)/10, sprite); GamePanel.b = new StickyBomb(GamePanel.player.x+GamePanel.camera.x,GamePanel.player.y,35, (xx-GamePanel.player.x)/20, (yy-GamePanel.player.y)/10, sprite);
} }
public void draw(Graphics g){ public void draw(Graphics g){