public void update(){
//		if(player.isDead()) fail = true;
		if(fail) return;
		
		for(int y = 0; y < height; y++){
			for(int x = 0; x < width; x++){
				mob[x][y] = -1;
			}
		}
		
		keys();
		mouse();
		
		for(Spawner s : spawners) s.update();
		for(Mob m : mobs){
			m.update();
			mob[m.getTileX()][m.getTileY()] = m.getId();
		}
		for(Item i : items) i.update();
		for(Particle p : particles) p.update();
//		player.update();
		mob[getPlayer().getTileX()][getPlayer().getTileY()] = getPlayer().getId();
		
		removeParticles();
		removeMobs();
		removeItems();
				
		/*
		 * THIS SMOOTHLY INTERPOLATES BETWEEN TWO POINTS USING THE LERP METHOD.
		 * Compared to the EDIT MODE lerp function, this will keep the player centred. Can follow any mob, replace player name with mob.
		 */
		
		xa = getPlayer().getX() - screen.width / 2;
		ya = getPlayer().getY() - screen.height / 2;
		if(xa < 0) xa = 0;
		if(ya < 0) ya = 0;
		if(xa > screen.width / 1.663) xa = (int) (screen.width / 1.663);
		if(ya > screen.height / 2.33) ya = (int) (screen.height / 2.33);
		
		xScroll = (int) lerp(xScroll, xa, cubic_scerve3(0.15f));
		yScroll = (int) lerp(yScroll, ya, cubic_scerve3(0.15f));
	}