	public void paintComponent(Graphics g){
        super.paintComponent(g);
        this.setBackground(Color.WHITE);
        if(Reset){
            character.x -= 10;
        }
        if(Restart){
			maxHealth -= 1;
		}
        g.setColor(getBackground());
        g.fillRect(InvLine.x, InvLine.y, InvLine.width, InvLine.height);
        g.setColor(getBackground());
        g.fillRect(InvLine2.x, InvLine2.y, InvLine2.width, InvLine2.height);
        g.fillRect(InvLine3.x, InvLine3.y, InvLine3.width, InvLine3.height);
        g.fillRect(StartingPoint.x, StartingPoint.y, StartingPoint.width, StartingPoint.height);
       g.setColor(Color.BLUE);
       g.fillRect(FinalBoss.x, FinalBoss.y, FinalBoss.width, FinalBoss.height);
        g.setColor(Color.RED);
        g.fillRect(Boss.x, Boss.y, Boss.width, Boss.height);
        g.fillRect(Boss2.x, Boss2.y, Boss2.width, Boss2.height);
        g.fillRect(Boss3.x, Boss3.y, Boss3.width, Boss3.height);
        g.fillRect(Boss4.x, Boss4.y, Boss4.width, Boss4.height);
        g.fillRect(Boss5.x, Boss5.y, Boss5.width, Boss5.height);
        g.setColor(Color.RED);
        g.setFont(g.getFont().deriveFont(35f));
        g.drawString("Life left " + maxHealth, 10, 35);
        if(RightSide)    
            g.setColor(Color.BLUE);
            else             
    		g.setColor(Color.BLUE);
            if(LeftSide)
            g.setColor(Color.BLUE);
            g.fillRect(character.x, character.y, character.width, character.height);
        g.setColor(Color.BLACK);
        g.fillRect(Top.x, Top.y, Top.width, Top.height);
        g.fillRect(Bottom.x, Bottom.y, Bottom.width, Bottom.height);
        g.fillRect(Left.x, Left.y, Left.width, Left.height);
        g.fillRect(Right.x, Right.y, Right.width, Right.height);
        g.fillRect(Line.x, Line.y, Line.width, Line.height);
        g.fillRect(Line2.x, Line2.y, Line2.width, Line2.height);
        if(Map1){
        g.setColor(Color.GREEN);
        g.fillRect(Holder1.x, Holder1.y, Holder1.width, Holder1.height);
        g.fillRect(Holder2.x, Holder2.y, Holder2.width, Holder2.height);
        g.fillRect(Holder3.x, Holder3.y, Holder3.width, Holder3.height);
        g.fillRect(Line3.x, Line3.y, Line3.width, Line3.height);
        g.fillRect(Line4.x, Line4.y, Line4.width, Line4.height);
        g.fillRect(Line5.x, Line5.y, Line5.width, Line5.height);
        g.fillRect(Line6.x, Line6.y, Line6.width, Line6.height);
        g.fillRect(line3.x, line3.y, line3.width, line3.height);
        g.fillRect(line4.x, line4.y, line4.width, line4.height);
        g.fillRect(line5.x, line5.y, line5.width, line5.height);
        g.fillRect(line6.x, line6.y, line6.width, line6.height);
        g.fillRect(line7.x, line7.y, line7.width, line7.height);
        g.fillRect(Line7.x, Line7.y, Line7.width, Line7.height);
        g.fillRect(Line8.x, Line8.y, Line8.width, Line8.height);
        g.fillRect(line8.x, line8.y, line8.width, line8.height);
        g.fillRect(Line9.x, Line9.y, Line9.width, Line9.height);
        g.fillRect(line9.x, line9.y, line9.width, line9.height);
        g.fillRect(Line10.x, Line10.y, Line10.width, Line10.height);
        g.fillRect(line10.x, line10.y, line10.width, line10.height);
        g.fillRect(Line11.x, Line11.y, Line11.width, Line11.height);
        g.fillRect(line11.x, line11.y, line11.width, line11.height);
        g.fillRect(Line12.x, Line12.y, Line12.width, Line12.height);
        g.fillRect(line12.x, line12.y, line12.width, line12.height);
        g.fillRect(Line13.x, Line13.y, Line13.width, Line13.height);
        g.fillRect(line13.x, line13.y, line13.width, line13.height);
        g.fillRect(Line14.x, Line14.y, Line14.width, Line14.height);
        g.fillRect(line14.x, line14.y, line14.width, line14.height);
        }
        if(Map2){
        	g.setColor(Color.RED);
        	g.fillRect(Line15.x, Line15.y, Line15.width, Line15.height);
        	g.fillRect(Line16.x, Line16.y, Line16.width, Line16.height);
        	g.fillRect(Line17.x, Line17.y, Line17.width, Line17.height);
        	g.fillRect(Line18.x, Line18.y, Line18.width, Line18.height);
        	g.fillRect(Line19.x, Line19.y, Line19.width, Line19.height);
        	g.fillRect(Line20.x, Line20.y, Line20.width, Line20.height);
        	g.fillRect(Line21.x, Line21.y, Line21.width, Line21.height);
        	g.fillRect(Line22.x, Line22.y, Line22.width, Line22.height);
        	g.fillRect(Line23.x, Line23.y, Line23.width, Line23.height);
        	g.fillRect(Line24.x, Line24.y, Line24.width, Line24.height);
        	g.fillRect(Line25.x, Line25.y, Line25.width, Line25.height);
        	g.fillRect(Line26.x, Line26.y, Line26.width, Line26.height);
        	g.fillRect(line15.x, line15.y, line15.width, line15.height);
        	g.fillRect(line16.x, line16.y, line16.width, line16.height);
        	g.fillRect(line17.x, line17.y, line17.width, line17.height);
        	g.fillRect(line18.x, line18.y, line18.width, line18.height);
        	g.fillRect(line19.x, line19.y, line19.width, line19.height);
        	g.fillRect(line20.x, line20.y, line20.width, line20.height);
        	g.fillRect(line21.x, line21.y, line21.width, line21.height);
        	g.fillRect(line22.x, line22.y, line22.width, line22.height);
        	g.fillRect(line23.x, line23.y, line23.width, line23.height);
        	g.fillRect(line24.x, line24.y, line24.width, line24.height);
        	g.fillRect(line25.x, line25.y, line25.width, line25.height);
        	g.fillRect(line26.x, line26.y, line26.width, line26.height);
        }
        if(Map3){
            g.setColor(Color.GREEN);
            g.fillRect(Holder1.x, Holder1.y, Holder1.width, Holder1.height);
            g.fillRect(Holder2.x, Holder2.y, Holder2.width, Holder2.height);
            g.fillRect(Holder3.x, Holder3.y, Holder3.width, Holder3.height);
            g.fillRect(Line3.x, Line3.y, Line3.width, Line3.height);
            g.fillRect(Line4.x, Line4.y, Line4.width, Line4.height);
            g.fillRect(Line5.x, Line5.y, Line5.width, Line5.height);
            g.fillRect(Line6.x, Line6.y, Line6.width, Line6.height);
            g.fillRect(line3.x, line3.y, line3.width, line3.height);
            g.fillRect(line4.x, line4.y, line4.width, line4.height);
            g.fillRect(line5.x, line5.y, line5.width, line5.height);
            g.fillRect(line6.x, line6.y, line6.width, line6.height);
            g.fillRect(line7.x, line7.y, line7.width, line7.height);
            g.fillRect(Line7.x, Line7.y, Line7.width, Line7.height);
            g.fillRect(Line8.x, Line8.y, Line8.width, Line8.height);
            g.fillRect(line8.x, line8.y, line8.width, line8.height);
            g.fillRect(Line9.x, Line9.y, Line9.width, Line9.height);
            g.fillRect(line9.x, line9.y, line9.width, line9.height);
            g.fillRect(Line10.x, Line10.y, Line10.width, Line10.height);
            g.fillRect(line10.x, line10.y, line10.width, line10.height);
            g.fillRect(Line11.x, Line11.y, Line11.width, Line11.height);
            g.fillRect(line11.x, line11.y, line11.width, line11.height);
            g.fillRect(Line12.x, Line12.y, Line12.width, Line12.height);
            g.fillRect(line12.x, line12.y, line12.width, line12.height);
            g.fillRect(Line13.x, Line13.y, Line13.width, Line13.height);
            g.fillRect(line13.x, line13.y, line13.width, line13.height);
            g.fillRect(Line14.x, Line14.y, Line14.width, Line14.height);
            g.fillRect(line14.x, line14.y, line14.width, line14.height);
            }
        if(KeysIns){
            g.setColor(Color.BLACK);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("Your goal", 123, 140);
            g.drawString("is to get", 126, 200);
            g.drawString("your character", 126, 250);
            g.drawString("to the SafeZone", 126, 300);
            g.drawString("Without touching the black line", 126, 350);
            g.drawString("Careful that you can go to the left", 126, 400);
            g.drawString("Through the walls but not right.", 126, 450);
            g.drawString("Be careful not to touch the Bosses.", 126, 500);
            g.setColor(Color.BLUE);           
            g.drawString("WASD / arrow", 251,550);
            g.drawString("keys to move", 251, 580);
            g.drawString("Shift in case of panic", 251, 615);
            g.drawString("R to Reset", 251, 650);
            g.drawString("Escape to Quit", 251, 670);
            g.drawString("Space to Sprint", 251, 690);
        if(DeathScreen){
        	g.setColor(Color.BLACK);
        	g.setFont(g.getFont().deriveFont(25f));
        	g.drawString("Press R to restart", 496, 300);
        	isMoving = false;
            }
        }
        if(Map1){
        	g.setColor(Color.BLUE);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("Level: 1 ", 253, 25); 
        }
        if(Map2){
        	g.setColor(Color.BLUE);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("Level: 2 ", 253, 25); 
        }
       if(Dead) {
            g.setColor(Color.RED);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("You Died", 496, 260); 
            g.drawString("Press R to restart", 496, 310); 
            isMoving = false;
            }
        if(Restart){
            character.x = 52;
            character.y = 52;
            Dead = false;
            DeathScreen = false;
            Finished = false;
        }
        if(StopReset1) {
            Reset = false;
        }
        if(FUp){
        	FDown = false;
        	FinalBoss.y -= 1;
        }
        if(FDown){
        	FUp = false;
        	FinalBoss.y += 1;
        }
        if(FRight){
        	FLeft = false;
        	FinalBoss.x += 1;
        }
        if(FLeft){
        	FRight = false;
        	FinalBoss.x -= 1;
        }
        if(FMoving){
        	if(FinalBoss.intersects(InvLine3)){
        		FLeft = false;
        		FRight = true;
        	} 
        	if(FinalBoss.intersects(InvLine)){
        		FRight = false;
        		FLeft = true;
        	}
        	if(FinalBoss.intersects(Top)){
        		FUp = false;
        		FDown = true;
        	}
        	if(FinalBoss.intersects(Bottom)){
        		FDown = false;
        		FUp = true;
        	}
        	if(FinalBoss.intersects(Line)){
        		FRight = false;
        		FLeft = true;
        	}
        	if(FinalBoss.intersects(Line2)){
        		FRight = false;
        		FLeft = true;
        	}
        	if(FinalBoss.intersects(Line14)){
        		FLeft = false;
        		FRight = true;
        	}
        	if(FinalBoss.intersects(line14)){
        		FLeft = false;
        		FRight = true;
        	}
       	}
        if(BUp){
        	BDown = false;
        	Boss.y -= 1;
        }
        if(BDown){
        	BUp = false;
        	Boss.y += 1;       	
        }
        if(BUp2){
        	BDown2 = false;       	
        	Boss2.y -= 1;
        }
        if(BDown2){
        	BUp2 = false;        	
        	Boss2.y += 1;
        }
        if(BUp3){
        	BDown3 = false;       	
        	Boss3.y -= 1;
        }
        if(BDown3){
        	BUp3 = false;        	
        	Boss3.y += 1;
        }
        if(BUp4){
        	BDown4 = false;       	
        	Boss4.y -= 1;
        }
        if(BDown4){
        	BUp4 = false;        	
        	Boss4.y += 1;
        }
        if(BUp5){
        	BDown5 = false;       	
        	Boss5.y -= 1;
        }
        if(BDown5){
        	BUp5 = false;        	
        	Boss5.y += 1;
        }
        if(BossMoving){
         	if(Boss.intersects(Top)){
         		BUp = false;
         		BDown = true;
         	}
         	if(Boss.intersects(Bottom)){
         		BDown = false;
         		BUp = true;
         	}
        	}
        if(BossMoving2){
         	if(Boss2.intersects(Top)){
         		BUp2 = false;
         		BDown2 = true;
         	}
         	if(Boss2.intersects(Bottom)){
         		BDown2 = false;
         		BUp2 = true;
         	}
        	}
        if(BossMoving3){
         	if(Boss3.intersects(Top)){
         		BUp3 = false;
         		BDown3 = true;
         	}
         	if(Boss3.intersects(Bottom)){
         		BDown3 = false;
         		BUp3 = true;
         	}
        	}
        if(BossMoving4){
         	if(Boss4.intersects(Top)){
         		BUp4 = false;
         		BDown4 = true;
         	}
         	if(Boss4.intersects(Bottom)){
         		BDown4 = false;
         		BUp4 = true;
         	}
        	}
        if(BossMoving5){
         	if(Boss5.intersects(Top)){
         		BUp5 = false;
         		BDown5 = true;
         	}
         	if(Boss3.intersects(Bottom)){
         		BDown5 = false;
         		BUp5 = true;
         	}
        	}
        if(character.intersects(FinalBoss))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss2))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss3))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss4))  {
        	Dead = true;
        	isMoving = false;
    	DeathScreen = true;
    	character.x = 40000;
        }
        if(character.intersects(Boss5))  {
        	Dead = true;
        	isMoving = false;
        	DeathScreen = true;
        	character.x = 40000;
        }
        if(character.intersects(Right))  {
            character.x -= 10;
            StopReset1 = true;
        }
        if(character.intersects(Left))  {
            character.x += 10;
            StopReset1 = true;
        }
        if(character.intersects(Bottom))  {
            character.y -= 10;
            StopReset1 = true;
        }
       if(Map1){
        if(character.intersects(Holder1))  {
            character.y += 10;
            StopReset1 = true;
            SpeedBoost = true;
        }
        if(character.intersects(Holder2))  {
            character.y += 10;
            StopReset1 = true;
        }
        if(character.intersects(Holder3))  {
            character.y += 10;
            StopReset1 = true;
        }
        if(character.intersects(Top))  {
            character.y += 10;
            StopReset1 = true;
        }
        if(character.intersects(Line))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Line2))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Line3))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line4))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line5))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line6))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line3))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line4))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line5))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line6))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line7))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line7))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line8))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line8))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line9))  {
            Reset = true;          
            StopReset1 = true;}    
        if(character.intersects(Line9))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line10))  {
            Reset = true;           
            StopReset1 = true;}     
        if(character.intersects(Line10))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line11))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line11))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line12))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line12))  {
                Reset = true;        
                StopReset1 = true;}  
        if(character.intersects(line13))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line13))  {
                Reset = true;        
                StopReset1 = true;}  
        if(character.intersects(line14))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line14))  {
                Reset = true;        
                StopReset1 = true;}
      }
       if(Map2){
        if(character.intersects(Line15))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line16))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line17))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line18))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line19))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line20))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line21))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line22))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line23))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line24))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line25))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line26))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(line15))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line16))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line17))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line18))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line19))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line20))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line21))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line22))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line23))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line24))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line25))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line26))  {
            Reset = true;            
            StopReset1 = true;} 
       }
        if(character.intersects(InvLine)) {
            g.setColor(Color.BLUE);
            g.setFont(g.getFont().deriveFont(25f));
        }
        if(character.intersects(InvLine2)) {                                  
        	try {
    			Thread.sleep(300);
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}    		            
            Finished = true;           
        }
        if(Finished){
        	character.x = 52;
            character.y = 52;
        	g.setColor(Color.BLACK);
            g.setFont(g.getFont().deriveFont(35f));
        	 g.drawString("Thank you for Playing!", 440, 260);
             g.drawString("You Passed!", 500, 300);
             g.setColor(Color.BLUE);
             g.setFont(g.getFont().deriveFont(30));
             g.drawString("Close to Restart", 500, 500);
             Map1 = false;
             Map2 = true;     
             if(character.intersects(InvLine)){
            	 if(Map2){
            		 Map1 = Map2;
            		 Map2 = Map3;
            		 Map3 = true;
            		 Map2 = false;
            	 }
             }
             try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
             Finished = false;
        }
        if(character.intersects(StartingPoint)) {
        Restart = false;
        g.setColor(Color.BLACK);
        g.setFont(g.getFont().deriveFont(25f));
        g.drawString("Press K", 258, 100);
        g.drawString("for Instructions", 260, 145);
        g.setColor(Color.BLUE);
        g.drawString("WASD / arrow", 251,550);
        g.drawString("keys to move", 251, 580);
        }
        if(maxHealth <= 0){
        	 try {
     			Thread.sleep(300);
     		} catch (InterruptedException e) {
     			e.printStackTrace();
     		}    	
			lost = true;
		}
        if(lost){
        	character.x = 52;
            character.y = 52;
        	g.setColor(Color.BLACK);
            g.setFont(g.getFont().deriveFont(35f));
        	 g.drawString("You Lost!", 440, 260);
        	 g.setColor(Color.BLUE);
             g.setFont(g.getFont().deriveFont(30));
             g.drawString("Close to Restart", 500, 500);
        }
        if(jumping){
            character.y --;
        }
		if(right){
			character.x += verticalSpeed;
        }
		if(left){
			character.x -= verticalSpeed;
		}
            if(up)
                character.y += -verticalSpeed;
            if(down){
                character.y += verticalSpeed;
            }
		repaint();
	}

	public void paintComponent(Graphics g){
        super.paintComponent(g);
        this.setBackground(Color.WHITE);
        if(Reset){
            character.x -= 10;
        }
        if(Restart){
			maxHealth -= 1;
		}
        g.setColor(getBackground());
        g.fillRect(InvLine.x, InvLine.y, InvLine.width, InvLine.height);
        g.setColor(getBackground());
        g.fillRect(InvLine2.x, InvLine2.y, InvLine2.width, InvLine2.height);
        g.fillRect(InvLine3.x, InvLine3.y, InvLine3.width, InvLine3.height);
        g.fillRect(StartingPoint.x, StartingPoint.y, StartingPoint.width, StartingPoint.height);
       g.setColor(Color.BLUE);
       g.fillRect(FinalBoss.x, FinalBoss.y, FinalBoss.width, FinalBoss.height);
        g.setColor(Color.RED);
        g.fillRect(Boss.x, Boss.y, Boss.width, Boss.height);
        g.fillRect(Boss2.x, Boss2.y, Boss2.width, Boss2.height);
        g.fillRect(Boss3.x, Boss3.y, Boss3.width, Boss3.height);
        g.fillRect(Boss4.x, Boss4.y, Boss4.width, Boss4.height);
        g.fillRect(Boss5.x, Boss5.y, Boss5.width, Boss5.height);
        g.setColor(Color.RED);
        g.setFont(g.getFont().deriveFont(35f));
        g.drawString("Life left " + maxHealth, 10, 35);
        if(RightSide)    
            g.setColor(Color.BLUE);
            else             
    		g.setColor(Color.BLUE);
            if(LeftSide)
            g.setColor(Color.BLUE);
            g.fillRect(character.x, character.y, character.width, character.height);
        g.setColor(Color.BLACK);
        g.fillRect(Top.x, Top.y, Top.width, Top.height);
        g.fillRect(Bottom.x, Bottom.y, Bottom.width, Bottom.height);
        g.fillRect(Left.x, Left.y, Left.width, Left.height);
        g.fillRect(Right.x, Right.y, Right.width, Right.height);
        g.fillRect(Line.x, Line.y, Line.width, Line.height);
        g.fillRect(Line2.x, Line2.y, Line2.width, Line2.height);
        if(Map1){
        g.setColor(Color.GREEN);
        g.fillRect(Holder1.x, Holder1.y, Holder1.width, Holder1.height);
        g.fillRect(Holder2.x, Holder2.y, Holder2.width, Holder2.height);
        g.fillRect(Holder3.x, Holder3.y, Holder3.width, Holder3.height);
        g.fillRect(Line3.x, Line3.y, Line3.width, Line3.height);
        g.fillRect(Line4.x, Line4.y, Line4.width, Line4.height);
        g.fillRect(Line5.x, Line5.y, Line5.width, Line5.height);
        g.fillRect(Line6.x, Line6.y, Line6.width, Line6.height);
        g.fillRect(line3.x, line3.y, line3.width, line3.height);
        g.fillRect(line4.x, line4.y, line4.width, line4.height);
        g.fillRect(line5.x, line5.y, line5.width, line5.height);
        g.fillRect(line6.x, line6.y, line6.width, line6.height);
        g.fillRect(line7.x, line7.y, line7.width, line7.height);
        g.fillRect(Line7.x, Line7.y, Line7.width, Line7.height);
        g.fillRect(Line8.x, Line8.y, Line8.width, Line8.height);
        g.fillRect(line8.x, line8.y, line8.width, line8.height);
        g.fillRect(Line9.x, Line9.y, Line9.width, Line9.height);
        g.fillRect(line9.x, line9.y, line9.width, line9.height);
        g.fillRect(Line10.x, Line10.y, Line10.width, Line10.height);
        g.fillRect(line10.x, line10.y, line10.width, line10.height);
        g.fillRect(Line11.x, Line11.y, Line11.width, Line11.height);
        g.fillRect(line11.x, line11.y, line11.width, line11.height);
        g.fillRect(Line12.x, Line12.y, Line12.width, Line12.height);
        g.fillRect(line12.x, line12.y, line12.width, line12.height);
        g.fillRect(Line13.x, Line13.y, Line13.width, Line13.height);
        g.fillRect(line13.x, line13.y, line13.width, line13.height);
        g.fillRect(Line14.x, Line14.y, Line14.width, Line14.height);
        g.fillRect(line14.x, line14.y, line14.width, line14.height);
        }
        if(Map2){
        	g.setColor(Color.RED);
        	g.fillRect(Line15.x, Line15.y, Line15.width, Line15.height);
        	g.fillRect(Line16.x, Line16.y, Line16.width, Line16.height);
        	g.fillRect(Line17.x, Line17.y, Line17.width, Line17.height);
        	g.fillRect(Line18.x, Line18.y, Line18.width, Line18.height);
        	g.fillRect(Line19.x, Line19.y, Line19.width, Line19.height);
        	g.fillRect(Line20.x, Line20.y, Line20.width, Line20.height);
        	g.fillRect(Line21.x, Line21.y, Line21.width, Line21.height);
        	g.fillRect(Line22.x, Line22.y, Line22.width, Line22.height);
        	g.fillRect(Line23.x, Line23.y, Line23.width, Line23.height);
        	g.fillRect(Line24.x, Line24.y, Line24.width, Line24.height);
        	g.fillRect(Line25.x, Line25.y, Line25.width, Line25.height);
        	g.fillRect(Line26.x, Line26.y, Line26.width, Line26.height);
        	g.fillRect(line15.x, line15.y, line15.width, line15.height);
        	g.fillRect(line16.x, line16.y, line16.width, line16.height);
        	g.fillRect(line17.x, line17.y, line17.width, line17.height);
        	g.fillRect(line18.x, line18.y, line18.width, line18.height);
        	g.fillRect(line19.x, line19.y, line19.width, line19.height);
        	g.fillRect(line20.x, line20.y, line20.width, line20.height);
        	g.fillRect(line21.x, line21.y, line21.width, line21.height);
        	g.fillRect(line22.x, line22.y, line22.width, line22.height);
        	g.fillRect(line23.x, line23.y, line23.width, line23.height);
        	g.fillRect(line24.x, line24.y, line24.width, line24.height);
        	g.fillRect(line25.x, line25.y, line25.width, line25.height);
        	g.fillRect(line26.x, line26.y, line26.width, line26.height);
        }
        if(Map3){
            g.setColor(Color.GREEN);
            g.fillRect(Holder1.x, Holder1.y, Holder1.width, Holder1.height);
            g.fillRect(Holder2.x, Holder2.y, Holder2.width, Holder2.height);
            g.fillRect(Holder3.x, Holder3.y, Holder3.width, Holder3.height);
            g.fillRect(Line3.x, Line3.y, Line3.width, Line3.height);
            g.fillRect(Line4.x, Line4.y, Line4.width, Line4.height);
            g.fillRect(Line5.x, Line5.y, Line5.width, Line5.height);
            g.fillRect(Line6.x, Line6.y, Line6.width, Line6.height);
            g.fillRect(line3.x, line3.y, line3.width, line3.height);
            g.fillRect(line4.x, line4.y, line4.width, line4.height);
            g.fillRect(line5.x, line5.y, line5.width, line5.height);
            g.fillRect(line6.x, line6.y, line6.width, line6.height);
            g.fillRect(line7.x, line7.y, line7.width, line7.height);
            g.fillRect(Line7.x, Line7.y, Line7.width, Line7.height);
            g.fillRect(Line8.x, Line8.y, Line8.width, Line8.height);
            g.fillRect(line8.x, line8.y, line8.width, line8.height);
            g.fillRect(Line9.x, Line9.y, Line9.width, Line9.height);
            g.fillRect(line9.x, line9.y, line9.width, line9.height);
            g.fillRect(Line10.x, Line10.y, Line10.width, Line10.height);
            g.fillRect(line10.x, line10.y, line10.width, line10.height);
            g.fillRect(Line11.x, Line11.y, Line11.width, Line11.height);
            g.fillRect(line11.x, line11.y, line11.width, line11.height);
            g.fillRect(Line12.x, Line12.y, Line12.width, Line12.height);
            g.fillRect(line12.x, line12.y, line12.width, line12.height);
            g.fillRect(Line13.x, Line13.y, Line13.width, Line13.height);
            g.fillRect(line13.x, line13.y, line13.width, line13.height);
            g.fillRect(Line14.x, Line14.y, Line14.width, Line14.height);
            g.fillRect(line14.x, line14.y, line14.width, line14.height);
            }
        if(KeysIns){
            g.setColor(Color.BLACK);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("Your goal", 123, 140);
            g.drawString("is to get", 126, 200);
            g.drawString("your character", 126, 250);
            g.drawString("to the SafeZone", 126, 300);
            g.drawString("Without touching the black line", 126, 350);
            g.drawString("Careful that you can go to the left", 126, 400);
            g.drawString("Through the walls but not right.", 126, 450);
            g.drawString("Be careful not to touch the Bosses.", 126, 500);
            g.setColor(Color.BLUE);           
            g.drawString("WASD / arrow", 251,550);
            g.drawString("keys to move", 251, 580);
            g.drawString("Shift in case of panic", 251, 615);
            g.drawString("R to Reset", 251, 650);
            g.drawString("Escape to Quit", 251, 670);
            g.drawString("Space to Sprint", 251, 690);
        if(DeathScreen){
        	g.setColor(Color.BLACK);
        	g.setFont(g.getFont().deriveFont(25f));
        	g.drawString("Press R to restart", 496, 300);
        	isMoving = false;
            }
        }
        if(Map1){
        	g.setColor(Color.BLUE);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("Level: 1 ", 253, 25); 
        }
        if(Map2){
        	g.setColor(Color.BLUE);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("Level: 2 ", 253, 25); 
        }
       if(Dead) {
            g.setColor(Color.RED);
            g.setFont(g.getFont().deriveFont(25f));
            g.drawString("You Died", 496, 260); 
            g.drawString("Press R to restart", 496, 310); 
            isMoving = false;
            }
        if(Restart){
            character.x = 52;
            character.y = 52;
            Dead = false;
            DeathScreen = false;
            Finished = false;
        }
        if(StopReset1) {
            Reset = false;
        }
        if(FUp){
        	FDown = false;
        	FinalBoss.y -= 1;
        }
        if(FDown){
        	FUp = false;
        	FinalBoss.y += 1;
        }
        if(FRight){
        	FLeft = false;
        	FinalBoss.x += 1;
        }
        if(FLeft){
        	FRight = false;
        	FinalBoss.x -= 1;
        }
        if(FMoving){
        	if(FinalBoss.intersects(InvLine3)){
        		FLeft = false;
        		FRight = true;
        	} 
        	if(FinalBoss.intersects(InvLine)){
        		FRight = false;
        		FLeft = true;
        	}
        	if(FinalBoss.intersects(Top)){
        		FUp = false;
        		FDown = true;
        	}
        	if(FinalBoss.intersects(Bottom)){
        		FDown = false;
        		FUp = true;
        	}
        	if(FinalBoss.intersects(Line)){
        		FRight = false;
        		FLeft = true;
        	}
        	if(FinalBoss.intersects(Line2)){
        		FRight = false;
        		FLeft = true;
        	}
        	if(FinalBoss.intersects(Line14)){
        		FLeft = false;
        		FRight = true;
        	}
        	if(FinalBoss.intersects(line14)){
        		FLeft = false;
        		FRight = true;
        	}
       	}
        if(BUp){
        	BDown = false;
        	Boss.y -= 1;
        }
        if(BDown){
        	BUp = false;
        	Boss.y += 1;       	
        }
        if(BUp2){
        	BDown2 = false;       	
        	Boss2.y -= 1;
        }
        if(BDown2){
        	BUp2 = false;        	
        	Boss2.y += 1;
        }
        if(BUp3){
        	BDown3 = false;       	
        	Boss3.y -= 1;
        }
        if(BDown3){
        	BUp3 = false;        	
        	Boss3.y += 1;
        }
        if(BUp4){
        	BDown4 = false;       	
        	Boss4.y -= 1;
        }
        if(BDown4){
        	BUp4 = false;        	
        	Boss4.y += 1;
        }
        if(BUp5){
        	BDown5 = false;       	
        	Boss5.y -= 1;
        }
        if(BDown5){
        	BUp5 = false;        	
        	Boss5.y += 1;
        }
        if(BossMoving){
         	if(Boss.intersects(Top)){
         		BUp = false;
         		BDown = true;
         	}
         	if(Boss.intersects(Bottom)){
         		BDown = false;
         		BUp = true;
         	}
        	}
        if(BossMoving2){
         	if(Boss2.intersects(Top)){
         		BUp2 = false;
         		BDown2 = true;
         	}
         	if(Boss2.intersects(Bottom)){
         		BDown2 = false;
         		BUp2 = true;
         	}
        	}
        if(BossMoving3){
         	if(Boss3.intersects(Top)){
         		BUp3 = false;
         		BDown3 = true;
         	}
         	if(Boss3.intersects(Bottom)){
         		BDown3 = false;
         		BUp3 = true;
         	}
        	}
        if(BossMoving4){
         	if(Boss4.intersects(Top)){
         		BUp4 = false;
         		BDown4 = true;
         	}
         	if(Boss4.intersects(Bottom)){
         		BDown4 = false;
         		BUp4 = true;
         	}
        	}
        if(BossMoving5){
         	if(Boss5.intersects(Top)){
         		BUp5 = false;
         		BDown5 = true;
         	}
         	if(Boss3.intersects(Bottom)){
         		BDown5 = false;
         		BUp5 = true;
         	}
        	}
        if(character.intersects(FinalBoss))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss2))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss3))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Boss4))  {
        	Dead = true;
        	isMoving = false;
    	DeathScreen = true;
    	character.x = 40000;
        }
        if(character.intersects(Boss5))  {
        	Dead = true;
        	isMoving = false;
        	DeathScreen = true;
        	character.x = 40000;
        }
        if(character.intersects(Right))  {
            character.x -= 10;
            StopReset1 = true;
        }
        if(character.intersects(Left))  {
            character.x += 10;
            StopReset1 = true;
        }
        if(character.intersects(Bottom))  {
            character.y -= 10;
            StopReset1 = true;
        }
       if(Map1){
        if(character.intersects(Holder1))  {
            character.y += 10;
            StopReset1 = true;
            SpeedBoost = true;
        }
        if(character.intersects(Holder2))  {
            character.y += 10;
            StopReset1 = true;
        }
        if(character.intersects(Holder3))  {
            character.y -= 10;
            StopReset1 = true;
        }
        if(character.intersects(Top))  {
            character.y += 10;
            StopReset1 = true;
        }
        if(character.intersects(Line))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Line2))  {
            Dead = true;
            isMoving = false;
            DeathScreen = true;
            character.x = 40000;
        }
        if(character.intersects(Line3))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line4))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line5))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line6))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line3))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line4))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line5))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line6))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line7))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(Line7))  {
            Reset = true;
            StopReset1 = true;
        }
        if(character.intersects(line8))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line8))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line9))  {
            Reset = true;          
            StopReset1 = true;}    
        if(character.intersects(Line9))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line10))  {
            Reset = true;           
            StopReset1 = true;}     
        if(character.intersects(Line10))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line11))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line11))  {
                Reset = true;
                StopReset1 = true;}
        if(character.intersects(line12))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line12))  {
                Reset = true;        
                StopReset1 = true;}  
        if(character.intersects(line13))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line13))  {
                Reset = true;        
                StopReset1 = true;}  
        if(character.intersects(line14))  {
            Reset = true;            
            StopReset1 = true;}      
        if(character.intersects(Line14))  {
                Reset = true;        
                StopReset1 = true;}
      }
       if(Map2){
        if(character.intersects(Line15))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line16))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line17))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line18))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line19))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line20))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line21))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line22))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line23))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line24))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line25))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(Line26))  {
            Reset = true;
            StopReset1 = true;}
        if(character.intersects(line15))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line16))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line17))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line18))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line19))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line20))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line21))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line22))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line23))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line24))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line25))  {
            Reset = true;             
            StopReset1 = true;}       
        if(character.intersects(line26))  {
            Reset = true;            
            StopReset1 = true;} 
       }
        if(character.intersects(InvLine)) {
            g.setColor(Color.BLUE);
            g.setFont(g.getFont().deriveFont(25f));
        }
        if(character.intersects(InvLine2)) {                                  
        	try {
    			Thread.sleep(300);
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}    		            
            Finished = true;           
        }
        if(Finished){
        	character.x = 52;
            character.y = 52;
        	g.setColor(Color.BLACK);
            g.setFont(g.getFont().deriveFont(35f));
        	 g.drawString("Thank you for Playing!", 440, 260);
             g.drawString("You Passed!", 500, 300);
             g.setColor(Color.BLUE);
             g.setFont(g.getFont().deriveFont(30));
             g.drawString("Close to Restart", 500, 500);
             Map1 = false;
             Map2 = true;     
             if(character.intersects(InvLine)){
            	 if(Map2){
            		 Map1 = Map2;
            		 Map2 = Map3;
            		 Map3 = true;
            		 Map2 = false;
            	 }
             }
             try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
             Finished = false;
        }
        if(character.intersects(StartingPoint)) {
        Restart = false;
        g.setColor(Color.BLACK);
        g.setFont(g.getFont().deriveFont(25f));
        g.drawString("Press K", 258, 100);
        g.drawString("for Instructions", 260, 145);
        g.setColor(Color.BLUE);
        g.drawString("WASD / arrow", 251,550);
        g.drawString("keys to move", 251, 580);
        }
        if(maxHealth <= 0){
        	 try {
     			Thread.sleep(300);
     		} catch (InterruptedException e) {
     			e.printStackTrace();
     		}    	
			lost = true;
		}
        if(lost){
        	character.x = 52;
            character.y = 52;
        	g.setColor(Color.BLACK);
            g.setFont(g.getFont().deriveFont(35f));
        	 g.drawString("You Lost!", 440, 260);
        	 g.setColor(Color.BLUE);
             g.setFont(g.getFont().deriveFont(30));
             g.drawString("Close to Restart", 500, 500);
        }
        if(jumping){
            character.y --;
        }
		if(right){
			character.x += verticalSpeed;
        }
		if(left){
			character.x -= verticalSpeed;
		}
            if(up)
                character.y += -verticalSpeed;
            if(down){
                character.y += verticalSpeed;
            }
		repaint();
	}
