i am trying so that when i hit space bar my player should shoot fire ball.
right now what happening is that when i hit space bar my fire is drawn at 0, 0 pixs. but i want it so that the fire ball shoot right front of my player. and it should keep going to right.
public class Shoot { private int x; private int y; private int dx; private int width ; private int height; private boolean hitSPACE = false; //user hit space bar private boolean dead = true; //shoot is dead private static ImageIcon shoot_image = new ImageIcon("Image/shoot/bull2.png"); public Shoot() { dx = 3; width = 20; height = 20; } /*** get/set methods ***/ public static Image getSIMAGE() { return shoot_image.getImage(); } public int getX() { return x; } public void setX(int value) { this.x = value; } public int getY() { return y; } public void setY(int value) { this.y = value; } public int getWIDTH() { return width; } public void setWIDTH(int value) { this.width = value; } public int getHEIGHT() { return height; } public void setHEIGHT(int value) { this.height = value; } public boolean isDEAD() { return dead; } public void setDEAD(boolean value) { this.dead = value; } /*** Key pressed ***/ public void hitSHOOT() //user hit spacebar { hitSPACE = true; dead = true; } public void stopSHOOT() //user stop spacebar { hitSPACE = false; } // this method is in loop. so it will loop for every. public void PLAYER_SHOOT_MOVE(Main m, Player p, Shoot s) { x += dx; }/*** end of PLAYER_SHOOT method ***/ /*** paint method ***/ public void paint(Graphics g) { if(hitSPACE == true && dead == true) { g.drawImage(this.getSIMAGE(), x, y, width, height, null); } }/*** paint method ***/ }