public void UpdateGame(long gameTime, Point mousePosition)
    {
       
    	// adds a new duck to a random position if, enough time has past between the last duck
        if(System.nanoTime() - Duck.lastDuckTime >= Duck.timeBetweenDucks)
        {
           
            ducks.add(new Duck(Duck.duckLines[Duck.nextDuckLines][0] + random.nextInt(200), Duck.duckLines[Duck.nextDuckLines][1], Duck.duckLines[Duck.nextDuckLines][2], Duck.duckLines[Duck.nextDuckLines][3], duckImg));
            
          
            Duck.nextDuckLines++;
            if(Duck.nextDuckLines >= Duck.duckLines.length)
                Duck.nextDuckLines = 0;
            
            Duck.lastDuckTime = System.nanoTime();
        }
        
        // checks the position of each duck, if a duck passes over the frame it is being removed
        for(int i = 0; i < ducks.size(); i++)
        {
            
            ducks.get(i).Update();
            
            if(ducks.get(i).x < 0 - duckImg.getWidth())
            {
                ducks.remove(i);
                runawayDucks++;
            }
        }
        
     
        // checks if the mouse has been pressed
        if(Canvas.mouseButtonState(MouseEvent.BUTTON1))
        {
           
        	// handles the reload time of the gun
            if(System.nanoTime() - lastTimeShoot >= timeBetweenShots)
            {
                shoots++;
                
               //compares the position of the mouse with the position of each duck, if true  it removes the Duck
                for(int i = 0; i < ducks.size(); i++)
                {
                    if(new Rectangle(ducks.get(i).x + 18, ducks.get(i).y     , 100, 180).contains(mousePosition)) 
                    {
                        killedDucks++;
                        score += ducks.get(i).score;
                        
                       
                        ducks.remove(i);
                           break;
                    }
                }
                
                lastTimeShoot = System.nanoTime();
            }
        }
        
        // handles how many ducks have escaped
        if(runawayDucks >= 200)
            Framework.gameState = Framework.GameState.GAMEOVER;
    }