public void init() {
		        try
		        {
		            Level.loadBehaviors(new DataInputStream(ResourcesManager.class.getResourceAsStream("res/tiles.dat")));
		        }
		        catch (IOException e)
		        {
		            e.printStackTrace();
		            System.exit(0);
		        }

		        if(level==null)
		        	if(isCustom){
		        		CustomizedGenerator clg = new CustomizedGenerator();
		        		GamePlay gp = new GamePlay();
		        		gp = gp.read("player.txt");
		        		
		        		//read custom file
		        		//set seed, and other things based on that
		        		boolean nogaps = true;
		        		clg.seed = 7;
		        		if (nogaps){
		        			gp.timesOfDeathByFallingIntoGap = 10;
		        		}
		        		currentLevel = (Level)clg.generateLevel(gp);
		        		
		        		//You can use the following commands if you want to benefit from
		        		//	the interface containing detailed information
		        		String detailedInfo = FileHandler.readFile("DetailedInfo.txt");
		                
		              }
			        	else
		        		currentLevel = new RandomLevel(320, 15, levelSeed, levelDifficulty,levelType);

		        try {
					 level = currentLevel.clone();
				} catch (CloneNotSupportedException e) {
					e.printStackTrace();
				}

		        //level is always overground
		        Art.startMusic(1);

		        paused = false;
		        Sprite.spriteContext = this;
		        sprites.clear();

		        layer = new LevelRenderer(level, graphicsConfiguration, 320, 240);
		        for (int i = 0; i < 2; i++)
		        {
		            int scrollSpeed = 4 >> i;
		            int w = ((level.getWidth() * 16) - 320) / scrollSpeed + 320;
		            int h = ((level.getHeight() * 16) - 240) / scrollSpeed + 240;
		            Level bgLevel = BgLevelGenerator.createLevel(w / 32 + 1, h / 32 + 1, i == 0, levelType);
		            bgLayer[i] = new BgRenderer(bgLevel, graphicsConfiguration, 320, 240, scrollSpeed);
		        }

		        double oldX = 0;
		        if(mario!=null)
		        	oldX = mario.x;

		        mario = new Mario(this);
		        sprites.add(mario);
		        startTime = 1;

		        timeLeft = 200*15;

		        tick = 0;

		        /*
		         * SETS UP ALL OF THE CHECKPOINTS TO CHECK FOR SWITCHING
		         */
		        switchPoints = new ArrayList<Double>();

		        //first pick a random starting waypoint from among ten positions
		    	int squareSize = 16; //size of one square in pixels
		        int sections = 10;

		    	double startX = 32; //mario start position
		    	double endX = level.getxExit()*squareSize; //position of the end on the level
		    	if(!isCustom && recorder==null)
		    		recorder = new DataRecorder(this,(RandomLevel)level,keys);

		        gameStarted = false;
			}