[solved]Shooting towards the mouse

I am having trouble shooting a bullet towards the mouse. The bullet shoots fine and moves towards the mouse however clicking to shoot again will adjust the old bullets rotation aswell. For example i click on the left, the bullet will fly off to the left as expected you then click to the right and another bullet will appear and fly off to the right as expect however the first bullet fired will follow the second bullet fired because the mouses position as been updated. My question to you guys is how do i make it so that once a shot has been fired its velocity doesnt change after?

Bullet Class

public Bullet(int x, int y, int type) {
		super(x, y);
		this.type = type;
		Image();
	}
	
	public void update() {
		y += velY;
		x += velX;
		y += secvelY;
		x += secvelX;
		
		if (type == 0) { currentImage = lead_Bullet;}
		if (type == 1) { currentImage = laser_Bullet;}
	}
	
	public void draw(Graphics2D g2d) {
		g2d.drawImage(currentImage, x, y, null);
		if (Game.debugMode) { g2d.draw(getBounds());  }
	}

	public static double velX;
	public static double velY;
	public static int secvelX;
	public static int secvelY;
	public int type=0;
	public Image currentImage;
	
	// Characters
	private Image lead_Bullet;
	private Image laser_Bullet;
	
	
	public void Image() {
		ImageIcon q1 = new ImageIcon(this.getClass().getResource("/misc/lead bullet.png"));
		lead_Bullet = q1.getImage();
		ImageIcon q2 = new ImageIcon(this.getClass().getResource("/mobs/player old 1/player_right_old1.png"));
		laser_Bullet = q2.getImage();
	}
	 public Rectangle getBounds() {
		return new Rectangle (x,y,9,9);
	 }
}

Shooting code:

public static void shoot() {shot = true;}
	public void BulletUpdate() {
		if (shot==true && Lead_Bullets > 0) {
			shotTimer++;
			Bullet tempBullet = new Bullet(Game.player.x, Game.player.y, 0);
			Bullets.add(tempBullet);
			dx = Object_Control.msx - x;
			dy = Object_Control.msy - y;
			
			double theta = Math.atan2(Object_Control.msy - y, Object_Control.msx - x);
			dx = (int) ((Environment.speed*bulletspeed)*Math.cos(theta));
			dy = (int) ((Environment.speed*bulletspeed)*Math.sin(theta));

			Bullet.velX = dx;
			Bullet.velY = dy;
			Lead_Bullets-=1;
		}
		if (shotTimer > 0) {
			shot = false;
			shotTimer = 0;
		}
	}

ALL help is appriecated :slight_smile: