package com.ld57.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;

import Global.Global;
import entities.PausePerson;

public class TitleScreen implements Screen {
	final ddd game;
	private OrthographicCamera camera;
	private Viewport vport;
	// add pause person. This is added to every screen in the game. ty.
	private PausePerson pp;
	private Sound enter;
	private Sound enter2;
	private Music chillMusic;
	// end pause variables
	private float cameraInitX;
	private float cameraInitY;
	private boolean isCameraPositionInitialized;
	private int cameraShakeTimer;
	private Sound thump;
	private Sound sfx_titlescreen;
	private float timer = .02f;
	private float timer2 = .2f;
	private boolean up;
	private boolean up2;
	private float angle = 1f;
	private float widthX;
	private float heightY;
	private float angle2 = 60f;
	private float widthX2;
	private float heightY2;
	private float angle3 = 120f;
	private float widthX3;
	private float heightY3;
	private float angle4 = 180f;
	private float widthX4;
	private float heightY4;
	private float angle5 = 240f;
	private float widthX5;
	private float heightY5;
	private float angle6 = 300f;
	private float widthX6;
	private float heightY6;
	private float nameZoomX = 16f;
	private float nameZoomY = 16f;
	private float textUp = 16f;
	private float textUp2 = 16f;
	private float textUp3 = 16f;
	private float textUp4 = 16f;
	private float textUp5 = 16f;
	private float textUp6 = 16f;
	private float textUp7 = 16f;
	private float textUp8 = 16f;
	private float textX = 16f;
	private float textX2 = 16f;
	private float textX3 = 16f;
	private float textX4 = 16f;
	private float textX5 = 16f;
	private float textX6 = 16f;
	private float textX7 = 16f;
	private float textX8 = 16f;
	private boolean isNameZoomRight;
	private boolean isNameZoomUp;
	private float timer3;
	private float upLocation;
	private Vector3 mousePos;
	private float widthMouse;
	private float heightMouse;
	private float angle7 = 60f;
	private float textUpSpeed;
	private float textUpSpeed2;
	private float textUpSpeed3;
	private float textUpSpeed4;
	private float textUpSpeed5;
	private float textUpSpeed6;
	private float textUpSpeed7;
	private float textUpSpeed8;

	// font title? yeah! (later)
	public TitleScreen(final ddd game) {
		this.game = game;
		camera = new OrthographicCamera();
		vport = new FitViewport(ddd.MW, ddd.MH, camera);
		sfx_titlescreen = Gdx.audio.newSound(Gdx.files.internal("sfx/select.ogg"));
		// menustuff:
		pp = new PausePerson(Gdx.graphics.getWidth() / 2 - 210, Gdx.graphics.getHeight() - 235f);
		enter = Gdx.audio.newSound(Gdx.files.internal("sfx/click.ogg"));
		enter2 = Gdx.audio.newSound(Gdx.files.internal("sfx/click2.ogg"));
		// music
		chillMusic = Gdx.audio.newMusic(Gdx.files.internal("sfx/dddMusic.ogg"));
		chillMusic.setLooping(true);
		thump = Gdx.audio.newSound(Gdx.files.internal("sfx/click3.ogg"));
		textUpSpeed = MathUtils.random(11f, 15f);
		textUpSpeed2 = MathUtils.random(11f, 15f);
		textUpSpeed3 = MathUtils.random(11f, 15f);
		textUpSpeed4 = MathUtils.random(11f, 15f);
		textUpSpeed5 = MathUtils.random(11f, 15f);
		textUpSpeed6 = MathUtils.random(11f, 15f);
		textUpSpeed7 = MathUtils.random(11f, 15f);
		textUpSpeed8 = MathUtils.random(11f, 15f);
	}

	@Override
	public void show() {
		if (!Global.SetVolumeToZero)
			sfx_titlescreen.play();
		Gdx.input.setInputProcessor(new InputAdapter() {
			@Override
			public boolean keyDown(int keyCode) {
				// add this first part for the pause portion of the screen. The escape button.
				// Otherwise retain the space control.
				// Maybe we'll have a clickable button on the bottom side for options?
				if (keyCode == Input.Keys.ESCAPE && !Global.IsPaused) {
					if (!Global.SetVolumeToZero)
						enter.play(2f);
					Global.IsPaused = true;
				} else if (keyCode == Input.Keys.ESCAPE && Global.IsPaused && Global.IsKeyBindings && Global.IsSetKey) {
					if (!Global.SetVolumeToZero)
						enter2.play(2f);
					Global.IsSetKey = false;
				} else if (keyCode == Input.Keys.ESCAPE && Global.IsPaused && Global.IsKeyBindings) {
					if (!Global.SetVolumeToZero)
						enter2.play(2f);
					Global.IsKeyBindings = false;
					pp.IsSwitchingToKeyBindings = true;
				} else if (keyCode == Input.Keys.ESCAPE && Global.IsPaused) {
					if (!Global.SetVolumeToZero)
						enter2.play(2f);
					Global.IsPaused = false;
				} else if ((keyCode == Input.Keys.SPACE || Gdx.input.isTouched()) && !Global.IsPaused) {
					Global.resetPlayersStats();
					// LevelTmx.isPlayerXYGotten = false;
					dispose();
					ScreenUtils.clear(0, 0, 0, 1);
					Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
					// System.out.println("we are ready to go to the game screen!!");
					game.setScreen(new GameScreen(game));
				}
				if (Global.IsSetKey && Global.IsPaused)
					Global.KeycodeSet = keyCode;
				return true;
			}

			@Override
			public boolean touchDown(int x, int y, int pointer, int button) {// this is for capturing mouse clicks
				if (Global.IsSetKey)
					Global.KeycodeSet = button;
				return true;
			}

		});
		// start the play back of the background music
		// when the screen is shown
		chillMusic.setVolume(.7f);
		if (!Global.IsMusicPaused)
			chillMusic.play();
	}

	@Override
	public void render(float delta) {
		ScreenUtils.clear(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		game.batch.setProjectionMatrix(camera.combined);
		if (!isCameraPositionInitialized) {
			cameraInitX = camera.position.x;
			cameraInitY = camera.position.y;
			isCameraPositionInitialized = true;
		}
		game.batch.begin();
		// add pause person. This is added to every screen in the game you want a pause
		// menu.
		if (Global.IsPaused) {
			pp.RenderEntirePauseMenu(delta, game, game.font, chillMusic, camera);
//			DebugRenderer.DrawDebugRectangle(pp.saveGameRect, Color.RED, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.loadGameRect, Color.GREEN, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.muteSoundRect, Color.PURPLE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.muteMusicRect, Color.BLUE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.keyBindingsRect, Color.ORANGE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.backRect, Color.BROWN, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.exitGameRect, Color.PINK, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.crouchRect, Color.WHITE, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.sprintRect, Color.GRAY, camera.combined);
//			DebugRenderer.DrawDebugRectangle(pp.keyBindingsBackRect, Color.YELLOW, camera.combined);
		} else {
			mousePos = camera.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
			dropTitleLetters(camera);

			game.batch.end();
			// if timer is less than .65 you need to go up.
			if (timer <= .648f) {
				up = true;
			}
			if (up)// if timer is greater than .68 you need to go down.
				timer += MathUtils.random(.001f, .0005f);
			else
				timer -= MathUtils.random(.001f, .0005f);
			if (timer >= .67f) {
				up = false;
			}
			// if timer is less than .65 you need to go up.
			if (timer2 <= .5f) {
				up2 = true;
			}
			if (up2)// if timer is greater than .68 you need to go down.
				timer2 += MathUtils.random(.0001f, .0005f);
			else
				timer2 -= MathUtils.random(.0001f, .0005f);
			if (timer2 >= .501f) {
				up2 = false;
			}
			if (timer3 >= 100f) {
				upLocation = MathUtils.random(.01f, .07f);
				timer3 = 0f;
			}
			if (timer3 < 100f)
				timer3 += .3f;
			// widthX = widthX + 500 * MathUtils.cos(angle) * 1.5f;
			heightY = heightY + 100 * MathUtils.sin(angle);
			angle += .01f;
			if (angle >= 360)
				angle = 1;
			// widthX2 = widthX2 + 100 * MathUtils.cos(angle2) * 1.5f;
			heightY2 = heightY2 + 100 * MathUtils.sin(angle2);
			angle2 += .01f;
			if (angle2 >= 360)
				angle2 = 1;
			// widthX3 = widthX3 + 100 * MathUtils.cos(angle3) * 1.5f;
			heightY3 = heightY3 + 100 * MathUtils.sin(angle3);
			angle3 += .01f;
			if (angle3 >= 360)
				angle3 = 1;
			// widthX4 = widthX4 - 100 * MathUtils.cos(angle4) * 1.5f;
			heightY4 = heightY4 + 100 * MathUtils.sin(angle4);
			angle4 += .01f;
			if (angle4 >= 360)
				angle4 = 1;
			// widthX5 = widthX5 - 100 * MathUtils.cos(angle5) * 1.5f;
			heightY5 = heightY5 + 100 * MathUtils.sin(angle5);
			angle5 += .01f;
			if (angle5 >= 360)
				angle5 = 1;
			// widthX6 = widthX6 - 10 * MathUtils.cos(angle6) * 1.5f;
			heightY6 = heightY6 + 100 * MathUtils.sin(angle6);
			angle6 += .01f;
			if (angle6 >= 360)
				angle6 = 1;
			// widthMouse = mousePos.x - 100f * MathUtils.cos(angle7);
			heightMouse = mousePos.y + 100f * MathUtils.sin(angle7);
			angle7 += .01f;
			if (angle7 >= 360)
				angle7 = 1;

			if (Gdx.input.isKeyJustPressed(Input.Keys.Q)) {
				// System.out.println("inputing Q");
				System.out.println("\r\r\r\r\r\r\r");// i dont know how to clear the consel this way without clicking on the
														// button.:)
				dispose();// hee hee i figured out how to reset the level. xD (dispose of the level and
							// reload it. ;-) )
				game.setScreen(new TitleScreen(game));
			}
		}
	}

	public void dropTitleLetters(OrthographicCamera camera) {
		float _targetWidth = 1200f;
		int _halign = 1;
		boolean _wrap = false;
		float _o = 50f;
		for (int i = 0; i < 23; i++) {
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.BROWN);
			game.font.draw(game.batch, "Dig Down Dude!", textX + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textUp + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "Dig Down Dude!", textX2 + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textUp2 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.BROWN);
			game.font.draw(game.batch, "Dig Down Dude!", textX3 + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textUp3 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "Dig Down Dude!", textX4 + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textUp4 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.BROWN);
			game.font.draw(game.batch, "Dig Down Dude!", textX5 + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textUp5 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "Dig Down Dude!", textX6 + Gdx.graphics.getWidth() * .126f * setScaleSizeY(i),
					textUp6 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize(i));
			game.font.setColor(Color.BROWN);
			game.font.draw(game.batch, "Dig Down Dude!", textX7 + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textUp7 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(setScaleSize2(i));
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "Dig Down Dude!", textX8 + Gdx.graphics.getWidth() * .028f * setScaleSizeY(i),
					textUp8 + i + Gdx.graphics.getHeight() * .352f * setScaleSizeY(i) - _o, _targetWidth, _halign, _wrap);
		}
		game.font.getData().setScale(1.0f);

		game.font.setColor(Color.YELLOW);
		game.font.draw(game.batch, "Press SPACE to Start!", Gdx.graphics.getWidth() * timer2 / 2 * .151f + 100 + timer2, Gdx.graphics.getHeight() / 4.5f * 1.209f,
				_targetWidth, _halign, _wrap);
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "get power?", widthX, heightY, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.GREEN);
			game.font.draw(game.batch, "get power?", widthX, heightY, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.ORANGE);
			game.font.draw(game.batch, "get resources", widthX2, heightY2, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.ORANGE);
			game.font.draw(game.batch, "get resources", widthX2, heightY2, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.RED);
			game.font.draw(game.batch, "get more power", widthX3, heightY3, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.RED);
			game.font.draw(game.batch, "get more power", widthX3, heightY3, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.BLUE);
			game.font.draw(game.batch, "made in 48 hours!", widthX4, heightY4, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.BLUE);
			game.font.draw(game.batch, "made in 48 hours!", widthX4, heightY4, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.PURPLE);
			game.font.draw(game.batch, "unicorns", widthX5, heightY5, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.PURPLE);
			game.font.draw(game.batch, "unicorns", widthX5, heightY5, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.YELLOW);
			game.font.draw(game.batch, "eat food", widthX6, heightY6, _targetWidth, _halign, _wrap);
		} else {
			game.font.setColor(Color.YELLOW);
			game.font.draw(game.batch, "eat food", widthX6, heightY6, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.setColor(Color.GOLDENROD);
			game.font.draw(game.batch, "buttercups and daisies", widthX6 + 400f * timer3 * upLocation, heightY6 + 100f * timer3 * .1f, _targetWidth, _halign, _wrap);
		}
		if (ddd.GameSettings.getBoolean("isFairyEvent")) {
			game.font.getData().setScale(.5f);
			game.font.setColor(Color.CYAN);
			game.font.draw(game.batch, "say what?", 800f, 100f + timer2, _targetWidth, _halign, _wrap);
			game.font.getData().setScale(1.0f);
		}
		game.font.setColor(Color.SCARLET);
		game.font.draw(game.batch, "weeeeeeeeeeeeeeeeeeeeee!", widthX6 * timer3 * upLocation, heightY6 * timer3 * .1f, _targetWidth, _halign, _wrap);
		// fairys: //TODO: if there is time, replace this with the actual fairies. xD
		game.font.setColor(Color.BROWN);
		game.font.draw(game.batch, "Dig Down Dude!", widthMouse - 600f, heightMouse - 10f, _targetWidth, _halign, _wrap);
		game.font.setColor(Color.CHARTREUSE);
		game.font.draw(game.batch, "Dig Down Dude!", widthMouse - 600f, heightMouse, _targetWidth, _halign, _wrap);
		// System.out.println("y: " + Gdx.graphics.getHeight() * 1.2f);
		game.font.setColor(Color.WHITE);
		widthX = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX2 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY2 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX3 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY3 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX4 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY4 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX5 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY5 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthX6 = Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightY6 = Gdx.graphics.getHeight() / 4 * 1.2f;
		widthMouse = mousePos.x;// Gdx.graphics.getWidth() / 2 * .15f + 75;
		heightMouse = mousePos.y;// Gdx.graphics.getHeight() / 4 * 1.2f;
		game.font.draw(game.batch, "press SPACE to Start!", Gdx.graphics.getWidth() * timer2 / 2 * .15f + 100, Gdx.graphics.getHeight() / 4.5f * 1.2f, _targetWidth,
				_halign, _wrap);
		game.font.getData().setScale(1.0f);// this resets the rest of the font to normal (it's only used for the above

		for (int i = 0; i < 150; i++) {
			game.font.setColor(.9f, .7f, setColorNumber(i), 1);
			if (isNameZoomRight && isNameZoomUp)
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX - 10 * i), (float) (nameZoomY - 10 * i));
			else if (isNameZoomRight && !isNameZoomUp)
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX - 10 * i), (float) (nameZoomY + 10 * i));
			else if (!isNameZoomRight && isNameZoomUp)
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX + 10 * i), (float) (nameZoomY - 10 * i));
			else
				game.font.draw(game.batch, "By Commanderstitch!", (float) (nameZoomX + 10 * i), (float) (nameZoomY + 10 * i));
		}
		game.font.getData().setScale(1f);
		game.font.setColor(Color.BROWN);
		game.font.draw(game.batch, "By Commanderstitch!", nameZoomX, nameZoomY);
		game.font.getData().setScale(1.0f);// this resets the rest of the font to normal (it's only used for the above

		// move the name left and right. then up and down. ruld//
		float _offsetX = -500f;
		if (nameZoomX <= 16)
			isNameZoomRight = true;
		if (nameZoomX >= ddd.MW - 246)
			isNameZoomRight = false;
		if (isNameZoomRight)
			nameZoomX += MathUtils.random(2f, 4f);
		else
			nameZoomX -= MathUtils.random(2f, 4f);
		if (nameZoomY <= 64)
			nameZoomY = ddd.MH;
		if (nameZoomY >= ddd.MH + 100)
			isNameZoomUp = false;
		nameZoomY = 16;
		if (isNameZoomUp)
			nameZoomY += MathUtils.random(2f, 4f);
		else
			nameZoomY -= MathUtils.random(2f, 4f);

		if (textUp >= ddd.MH - 50) {
			textUp = -ddd.MH;
			textUpSpeed = MathUtils.random(3f, 15f);
			textX = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp += textUpSpeed;
		if (textUp2 >= ddd.MH - 50) {
			textUp2 = -ddd.MH;
			textUpSpeed2 = MathUtils.random(3f, 15f);
			textX2 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp2 += textUpSpeed2;
		if (textUp3 >= ddd.MH - 50) {
			textUp3 = -ddd.MH;
			textUpSpeed3 = MathUtils.random(3f, 15f);
			textX3 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp3 += textUpSpeed3;
		if (textUp4 >= ddd.MH - 50) {
			textUp4 = -ddd.MH;
			textUpSpeed4 = MathUtils.random(3f, 15f);
			textX4 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp4 += textUpSpeed4;
		if (textUp5 >= ddd.MH - 50) {
			textUp5 = -ddd.MH;
			textUpSpeed5 = MathUtils.random(3f, 15f);
			textX5 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp5 += textUpSpeed5;
		if (textUp6 >= ddd.MH - 50) {
			textUp6 = -ddd.MH;
			textUpSpeed6 = MathUtils.random(3f, 15f);
			textX6 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp6 += textUpSpeed6;
		if (textUp7 >= ddd.MH - 50) {
			textUp7 = -ddd.MH;
			textUpSpeed7 = MathUtils.random(3f, 15f);
			textX7 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp7 += textUpSpeed7;
		if (textUp8 >= ddd.MH - 50) {
			textUp8 = -ddd.MH;
			textUpSpeed8 = MathUtils.random(3f, 15f);
			textX8 = MathUtils.random(_offsetX, ddd.MW + _offsetX);
		}
		textUp8 += textUpSpeed8;

		if (cameraShakeTimer > 0) {
			u.UsefulMethods.MoveCameraAroundRandomly(camera, 1, 1);
			camera.update();
			cameraShakeTimer -= 1;
		} else {
			camera.position.x = cameraInitX;
			camera.position.y = cameraInitY;
		}
	}

	private float setScaleSize(int i) {
		if (i == 0)
			return 4.0f;
		if (i == 1)
			return 3.8f;
		if (i == 2)
			return 3.6f;
		if (i == 3)
			return 3.4f;
		if (i == 4)
			return 3.2f;
		if (i == 5)
			return 3.0f;
		if (i == 6)
			return 2.8f;
		if (i == 7)
			return 2.6f;
		if (i == 8)
			return 2.4f;
		if (i == 9)
			return 2.2f;
		if (i == 10)
			return 2.0f;
		if (i == 11)
			return 1.8f;
		if (i == 12)
			return 1.6f;
		if (i == 13)
			return 1.4f;
		if (i == 14)
			return 1.2f;
		if (i == 15)
			return 1.0f;
		if (i == 16)
			return .8f;
		if (i == 17)
			return .6f;
		if (i == 18)
			return .4f;
		if (i == 19)
			return .2f;
		if (i == 20)
			return .1f;
		else
			return 3.0f;
	}

	private float setScaleSize2(int i) {
		if (i == 0)
			return 3.9f;
		if (i == 1)
			return 3.7f;
		if (i == 2)
			return 3.5f;
		if (i == 3)
			return 3.3f;
		if (i == 4)
			return 3.1f;
		if (i == 5)
			return 2.9f;
		if (i == 6)
			return 2.7f;
		if (i == 7)
			return 2.5f;
		if (i == 8)
			return 2.3f;
		if (i == 9)
			return 2.1f;
		if (i == 10)
			return 1.9f;
		if (i == 11)
			return 1.7f;
		if (i == 12)
			return 1.5f;
		if (i == 13)
			return 1.3f;
		if (i == 14)
			return 1.1f;
		if (i == 15)
			return .9f;
		if (i == 16)
			return .7f;
		if (i == 17)
			return .5f;
		if (i == 18)
			return .3f;
		if (i == 19)
			return .1f;
		if (i == 20)
			return .09f;
		else
			return 3.0f;
	}

	private float setScaleSizeY(int i) {
		if (i == 0)
			return 3.0f;
		if (i == 1)
			return 2.9f;
		if (i == 2)
			return 2.8f;
		if (i == 3)
			return 2.7f;
		if (i == 4)
			return 2.6f;
		if (i == 5)
			return 2.5f;
		if (i == 6)
			return 2.4f;
		if (i == 7)
			return 2.3f;
		if (i == 8)
			return 2.2f;
		if (i == 9)
			return 2.1f;
		if (i == 10)
			return 2.0f;
		if (i == 11)
			return 1.9f;
		if (i == 12)
			return 1.8f;
		if (i == 13)
			return 1.7f;
		if (i == 14)
			return 1.6f;
		if (i == 15)
			return 1.5f;
		if (i == 16)
			return 1.4f;
		if (i == 17)
			return 1.3f;
		if (i == 18)
			return 1.2f;
		if (i == 19)
			return 1.1f;
		if (i == 20)
			return 1.0f;
		else
			return 3.0f;
	}

	private float setColorNumber(int i) {
		if (i == 0)
			return 1f;
		if (i == 1)
			return .9f;
		if (i == 2)
			return .8f;
		if (i == 3)
			return .7f;
		if (i == 4)
			return .6f;
		if (i == 5)
			return .5f;
		if (i == 6)
			return .4f;
		if (i == 7)
			return .3f;
		if (i == 8)
			return .2f;
		if (i == 9)
			return .1f;
		if (i == 10)
			return .1f;
		else
			return 1f;
	}

	@Override
	public void hide() {
		Gdx.input.setInputProcessor(null);
	}

	@Override
	public void resize(int width, int height) {
		vport.update(width, height, true);
	}

	@Override
	public void pause() {
	}

	@Override
	public void resume() {
	}

	@Override
	public void dispose() {
		sfx_titlescreen.dispose();
		enter.dispose();
		enter2.dispose();
		thump.dispose();
		chillMusic.dispose();
	}

}
