require "Dialogs"

timer = -62
Black = CreateSprite("Pixel","Top")
Black.MoveTo(320, 240)
Black.Scale(640, 480)
Black.color = {0,0,0}
Preview = CreateSprite("preview","Top")
Preview.MoveTo(320, 5240)
Preview.Scale(640/1020*100, 640/1020*100)

function Update()
	if GetAlMightyGlobal("IdiomaFirst") then
		timer = timer + 1
	else
		timer = timer - 1
	end
	if timer > -1000 and timer <= -970 then
		Jodete.alpha = 1/30*(1000 + timer)
	elseif timer > -970 and timer <= -960 then
		if Input.Confirm == 1 then
			Misc.DestroyWindow()
		end
		timer = -970
	elseif timer == -120 and not GetAlMightyGlobal("IdiomaFirst") then
		Seleccion = CreateText("[instant][novoice][font:uidialog]Please select a language.\n\nPor favor seleccione un lenguaje.\n\nПожалуйста, выберите язык.", {0, 0}, 600, "Top")
		Seleccion.progressmode = "none"
		Seleccion.alpha = 0
		Seleccion.MoveTo(70, 340)
		Seleccion.HideBubble()
		English = CreateText("[instant][novoice][font:uidialog]English", {0, 0}, 600, "Top")
		English.progressmode = "none"
		English.alpha = 0
		English.MoveTo(60, 120)
		English.HideBubble()
		Espanol = CreateText("[instant][novoice][font:uidialog]Español", {0, 0}, 600, "Top")
		Espanol.progressmode = "none"
		Espanol.alpha = 0
		Espanol.MoveTo(270, 120)
		Espanol.HideBubble()
		Russian = CreateText("[instant][novoice][font:uidialog]Русский", {0, 0}, 600, "Top")
		Russian.progressmode = "none"
		Russian.alpha = 0
		Russian.MoveTo(480, 120)
		Russian.HideBubble()
	elseif timer <= -121 and timer > -151 and not GetAlMightyGlobal("IdiomaFirst") then
		Seleccion.alpha = 1/30*(-timer - 120)
		English.alpha = 1/30*(-timer - 120)
		Espanol.alpha = 1/30*(-timer - 120)
		Russian.alpha = 1/30*(-timer - 120)
	elseif timer == -180 and not GetAlMightyGlobal("IdiomaFirst") then
		Audio.PlaySound("pip")
		English.color = {1,1,0}
		Selecting = 1
	elseif timer == -181 and not GetAlMightyGlobal("IdiomaFirst") then
		if Input.Right == 1 then
			Audio.PlaySound("pip")
			Selecting = math.min(Selecting + 1, 3)
		end
		if Input.Left == 1 then
			Audio.PlaySound("pip")
			Selecting = math.max(Selecting - 1, 1)
		end
		if Selecting == 1 then
			English.color = {1,1,0}
			Espanol.color = {1,1,1}
			Russian.color = {1,1,1}
		elseif Selecting == 2 then
			English.color = {1,1,1}
			Espanol.color = {1,1,0}
			Russian.color = {1,1,1}
		else
			English.color = {1,1,1}
			Espanol.color = {1,1,1}
			Russian.color = {1,1,0}
		end
		if Input.Confirm == 1 then
			Audio.PlaySound("confirm")
			if Selecting == 1 then
				SetAlMightyGlobal("Idioma", "English")
			elseif Selecting == 2 then
				SetAlMightyGlobal("Idioma", "Spanish")
			else
				SetAlMightyGlobal("Idioma", "Russian")
			end
			SetAlMightyGlobal("IdiomaFirst", true)
			Encounter.Call("ReloadUI")
			Seleccion.Remove()
			English.Remove()
			Espanol.Remove()
			Russian.Remove()
			Seleccion = nil
			English = nil
			Espanol = nil
			Russian = nil
			timer = -61
		end
		timer = timer + 1
	elseif timer == -60 then
		if CYFversion ~= "0.6.5" then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				error("LEA ANTES DE REPORTAR\n\nLo siento pero parece que tienes una versión diferente de CYF de la que se requiere para este mod.\n\nNECESITAS CYF 0.6.5 PARA JUGAR ESTE MOD, NO UNA MAYOR NI UNA MENOR.\n\nEsto es para evitar unos bugs y errores que pasan por las otras versiones.\n\nGracias por leer y ten un buen dia.", 0)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				error("ПРОЧТИТЕ ПЕРЕД ТЕМ, КАК СООБЩАТЬ ОБ ОШИБКЕ\n\nМне очень жаль, но похоже, что версия вашего CYF отличается от версии необходимой для данной модификации.\n\nВАМ НЕОБХОДИМ CYF 0.6.5, ЧТОБЫ ИГРАТЬ В ДАННУЮ МОДИФИКАЦИЮ, НИ ВЫШЕ НИ НИЖЕ.\n\nЭто сделанно для того, чтобы избежать ошибок и сбоев, которые происходят из-за других версий.\n\nСпасибо за то, что прочитали и хорошего вам дня.", 0)
			else
				error("READ BEFORE REPORTING\n\nI'm sorry but it seems you have a different version of CYF than the one required for this mod.\n\nYOU NEED CYF 0.6.5 TO PLAY THIS MOD, NOT HIGHER NOT LOWER.\n\nThis is to avoid some bugs and errors than happen because of other versions.\n\nThanks for reading and have a nice day.", 0)
			end
		end
		Test = CreateSprite("Pixel")
		Test.Remove()
		if Test.isactive then
			SetAlMightyGlobal("CYFRetroMode", false)
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Jodete = CreateText("[instant][novoice][font:uidialog]Tienes la RETROCOMPATIBILIDAD activada!\n\nLo siento pero no puedes jugar mi mod con eso activado.\n\nDebido a esto, tendre que cerrar tu CYF ahora mismo, y tu tendras que reabrirlo si quieres jugar.\n\nPresiona Z para continuar.", {0, 0}, 500, "Top")
				Jodete.MoveTo(80, 380)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Jodete = CreateText("[instant][novoice][font:uidialog]У вас включена опция RETROCOMPATIBILITY!\n\nПростите, но вы не можете сыграть в данную модификацию с этой опцией.\n\nИз-за этого мне придётся закрыть CYF прямо сейчас, а вам придётся перезапустить его, чтобы поиграть.\n\nНажмите Z, чтобы продолжить.", {0, 0}, 500, "Top")
				Jodete.MoveTo(80, 405)
			else
				Jodete = CreateText("[instant][novoice][font:uidialog]You have RETROCOMPATIBILITY activated!\n\nSorry but you can't play this mod with that thing activated.\n\nBecause of this, I will have to close your CYF right now, and you'll have to reopen it if you want to play.\n\nPress Z to continue.", {0, 0}, 500, "Top")
				Jodete.MoveTo(80, 390)
			end
			Jodete.progressmode = "none"
			Jodete.alpha = 0
			Jodete.HideBubble()
			timer = -1030
		end
		Test = nil
		if GetAlMightyGlobal("CrateYourFrisk") then
			SetAlMightyGlobal("CrateYourFrisk", false)
			if not Jodete then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Jodete = CreateText("[instant][novoice][font:uidialog]Al parece tenias activado el secreto de CYF, un modo que cambia el lenguaje a uno Temmie y cambia los botones de batalla necesarios para jugar este mod.\n\nDebido a esto, tendre que cerrar tu CYF ahora mismo, y tu tendras que reabrirlo si quieres jugar.\n\nPresiona Z para continuar.", {0, 0}, 500, "Top")
					Jodete.MoveTo(80, 380)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Jodete = CreateText("[instant][novoice][font:uidialog]Похоже, что вы активировали секретный режим CYF, в котором обычный язык меняется на язык Темми, он в свою очередь меняет кнопки, необходимые для этого мода.\n\nИз-за этого мне придётся закрыть CYF прямо сейчас, а вам придётся перезапустить его, чтобы поиграть.\n\nНажмите Z, чтобы продолжить.", {0, 0}, 500, "Top")
					Jodete.MoveTo(80, 405)
				else
					Jodete = CreateText("[instant][novoice][font:uidialog]Apparently you have activated the secret of CYF, a mode that changes the language to a Temmie one and changes the neccesary buttons to play this mod.\n\nBecause of this, I will have to close your CYF right now, and you'll have to reopen it if you want to play.\n\nPress Z to continue.", {0, 0}, 500, "Top")
					Jodete.MoveTo(80, 405)
				end
				Jodete.progressmode = "none"
				Jodete.alpha = 0
				Jodete.HideBubble()
			end
			timer = -1030
		end
	elseif timer > -60 and timer <= 60 then
		Preview.Scale(640/1020*(100 - 99/120*(timer + 60)), 640/1020*(100 - 99/120*(timer + 60)))
		Preview.MoveTo(320, 5240 - 5000/120*(timer + 60))
	elseif timer == 61 then
		Misc.ShakeScreen(30,5,true)
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Texto1 = CreateText("[instant][novoice][font:uidialog]Cargando", {0, 0}, 600, "Top")
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Texto1 = CreateText("[instant][novoice][font:uidialog]Загрузка", {0, 0}, 600, "Top")
		else
			Texto1 = CreateText("[instant][novoice][font:uidialog]Loading", {0, 0}, 600, "Top")
		end
		Texto1.progressmode = "none"
		Texto1.alpha = 0
		Texto1.Scale(2,2)
		Texto1.MoveTo(210, 180)
		Texto1.HideBubble()
		ProgressBox = CreateSprite("Specials/ProgressBox","Top")
		ProgressBox.alpha = 0
		ProgressBox.MoveTo(320, 120)
		ProgressBar = CreateSprite("Pixel","Top")
		ProgressBar.SetPivot(0,0.5)
		ProgressBar.SetParent(ProgressBox)
		ProgressBar.MoveTo(-285, 0)
		ProgressBar.Scale(0, 50)
	elseif timer > 100 and timer <= 130 then
		Preview.alpha = 1 - 0.5/30*(timer - 100)
		Texto1.alpha = 1/30*(timer - 100)
		ProgressBox.alpha = 1/30*(timer - 100)
	elseif timer == 150 then
		Box("hola", "", "", "", 0, 0, nil, nil, 1)
		Box("", "", "", "", 0, 0, nil, nil, 1)
		Bubble("hola", "rightwide", 0, 0, 0, 0, 1)
		Bubble("", "", 0, 0, 0, 0, 1)
		Dialog("hola", {X = 250, Y = 260}, nil, nil, 1)
		Dialog("", nil, nil, nil, 1)
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Aturded/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Aturded/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Aturded/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Aturded/4")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Inside Front/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Inside Front/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Inside Front/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Inside Front/4")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Front/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Front/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Front/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Front/4")
	elseif timer == 155 then
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Left/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Left/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Left/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Left/4")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Right/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Right/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Right/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Coming Out Right/4")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Hurt/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Hurt/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Hurt/3")
	elseif timer == 160 then
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Front/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Front/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Front/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Left/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Left/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Left/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Right/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Right/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Shooting Right/3")
	elseif timer == 165 then
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Smiling/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Smiling/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Smiling/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/5")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/6")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/7")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/8")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/9")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/10")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/11")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Throwing Front/12")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Car/Empty")
	elseif timer == 170 then
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/1")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/2")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/3")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/4")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/5")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/6")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/7")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/8")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/9")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/10")
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Intro/11")
	elseif timer == 175 then
		LoadSprite("Bowsy Attacks Sprites/Bowsy/Dead")
		LoadSprite("Bowsy Attacks Sprites/Flames/Explotion/1")
		LoadSprite("Bowsy Attacks Sprites/Flames/Explotion/2")
		LoadSprite("Bowsy Attacks Sprites/Flames/Explotion/3")
		LoadSprite("Bowsy Attacks Sprites/Flames/Explotion/4")
	elseif timer == 180 then
		for i=1,8 do
			LoadSprite("Bowsy Attacks Sprites/Flames/InFloor/"..i)
		end
		for i=1,5 do
			LoadSprite("Bowsy Attacks Sprites/Flames/"..i)
		end
	elseif timer == 190 then
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Aturded/1")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Aturded/2")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Aturded/3")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Aturded/4")
		for i=1,9 do
			LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Cannon Angry/"..i)
		end
	elseif timer == 195 then
		for i=1,8 do
			LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Cannon Normal/"..i)
		end
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Angry")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Confuse")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Normal")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Front/Sad")
	elseif timer == 200 then
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Left/Angry")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Left/Normal")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Left/Sad")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Right/Angry")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Right/Normal")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Right/Sad")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Shocks/1")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Shocks/2")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Shocks/3")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/Shocks/4")
	elseif timer == 205 then
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/1")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/2")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/3")
		LoadSprite("Bowsy Attacks Sprites/Helikoopa/4")
		LoadSprite("Bowsy Attacks Sprites/Shell/1")
		LoadSprite("Bowsy Attacks Sprites/Shell/2")
		LoadSprite("Bowsy Attacks Sprites/Shell/3")
		LoadSprite("Bowsy Attacks Sprites/Shell/4")
	elseif timer == 210 then
		LoadSprite("Bowsy Attacks Sprites/Smoke/1")
		LoadSprite("Bowsy Attacks Sprites/Smoke/2")
		LoadSprite("Bowsy Attacks Sprites/Smoke/3")
		LoadSprite("Bowsy Attacks Sprites/Smoke/4")
		LoadSprite("Bowsy Attacks Sprites/Arrow")
		LoadSprite("Bowsy Attacks Sprites/Ball")
		LoadSprite("Bowsy Attacks Sprites/boom")
		LoadSprite("Bowsy Attacks Sprites/Hammer")
		LoadSprite("Bowsy Attacks Sprites/Spike")
	elseif timer == 220 then
		for i=135,238 do
			LoadSprite("Bullets/Bones/Super/"..i)
		end
	elseif timer == 230 then
		LoadSprite("Bullets/Bones/Big")
		LoadSprite("Bullets/Bones/Body")
		LoadSprite("Bullets/Bones/BodyS")
		LoadSprite("Bullets/Bones/BoneP")
		LoadSprite("Bullets/Bones/BoneS")
		LoadSprite("Bullets/Bones/Broken Bone")
		LoadSprite("Bullets/Bones/Bunch")
		LoadSprite("Bullets/Bones/BunchBonesPaps")
		LoadSprite("Bullets/Bones/BunchBonesSans")
	elseif timer == 235 then
		LoadSprite("Bullets/Bones/Cool")
		LoadSprite("Bullets/Bones/Dude")
		LoadSprite("Bullets/Bones/Dude")
		LoadSprite("Bullets/Bones/Head")
		LoadSprite("Bullets/Bones/HeadS")
		LoadSprite("Bullets/Bones/Left Bone")
		LoadSprite("Bullets/Bones/Long Bone")
		LoadSprite("Bullets/Bones/Masive")
		LoadSprite("Bullets/Bones/Right Bone v2")
		LoadSprite("Bullets/Bones/Right Bone")
	elseif timer == 240 then
		LoadSprite("Bullets/Bones/Skate")
		LoadSprite("Bullets/Bones/Spam")
		LoadSprite("Bullets/Bones/Special")
		LoadSprite("Bullets/GB Papyrus/0")
		LoadSprite("Bullets/GB Papyrus/1")
		LoadSprite("Bullets/GB Papyrus/Left")
		LoadSprite("Bullets/GB Papyrus/Right")
		for i=0,5 do
			LoadSprite("Bullets/GB Sans/"..i)
		end
	elseif timer == 245 then
		LoadSprite("Bullets/Magical Platforms/28")
		LoadSprite("Bullets/Magical Platforms/35")
		LoadSprite("Bullets/Magical Platforms/48")
		LoadSprite("Bullets/Magical Platforms/70")
		LoadSprite("Bullets/Magical Platforms/80")
		LoadSprite("Bullets/Magical Platforms/96")
		LoadSprite("Bullets/Magical Platforms/Special")
		LoadSprite("Bullets/Platforms/28")
		LoadSprite("Bullets/Platforms/35")
		LoadSprite("Bullets/Platforms/48")
	elseif timer == 250 then
		LoadSprite("Bullets/Platforms/70")
		LoadSprite("Bullets/Platforms/80")
		LoadSprite("Bullets/Platforms/96")
		LoadSprite("Bullets/Platforms/Special")
		LoadSprite("Bullets/Arrow Blue")
		LoadSprite("Bullets/Arrow Red")
		LoadSprite("Bullets/Arrow Yellow")
		LoadSprite("Bullets/Carro Volteado")
		LoadSprite("Bullets/Carro")
	elseif timer == 260 then
		LoadSprite("Bullets/GB Laser 2")
		LoadSprite("Bullets/GB Laser")
		LoadSprite("Bullets/GB Rafaga 1")
		LoadSprite("Bullets/GB Rafaga 2")
		LoadSprite("Bullets/Pelota")
		LoadSprite("Bullets/Smoke")
		LoadSprite("Bullets/Spear")
		LoadSprite("Bullets/Watch Out")
	elseif timer == 270 then
		local idiomas = {"English", "Spanish", "Russian"}
		for i=1,3 do
			LoadSprite("Credits/"..idiomas[i].."/Based")
			LoadSprite("Credits/"..idiomas[i].."/Blaster")
			LoadSprite("Credits/"..idiomas[i].."/Cezar")
			LoadSprite("Credits/"..idiomas[i].."/Flames")
			LoadSprite("Credits/"..idiomas[i].."/Made")
			LoadSprite("Credits/"..idiomas[i].."/Music")
			LoadSprite("Credits/"..idiomas[i].."/Papyrus")
			LoadSprite("Credits/"..idiomas[i].."/Phase 1")
			LoadSprite("Credits/"..idiomas[i].."/Phase 2")
			LoadSprite("Credits/"..idiomas[i].."/Phase 3")
			LoadSprite("Credits/"..idiomas[i].."/Phase 4")
			LoadSprite("Credits/"..idiomas[i].."/Song 2")
			LoadSprite("Credits/"..idiomas[i].."/Song")
			LoadSprite("Credits/"..idiomas[i].."/Thanks")
			LoadSprite("Credits/"..idiomas[i].."/THE END")
			LoadSprite("Credits/"..idiomas[i].."/Theme 1")
			LoadSprite("Credits/"..idiomas[i].."/Theme 2")
			LoadSprite("Credits/"..idiomas[i].."/Theme 3")
			LoadSprite("Credits/"..idiomas[i].."/Themes")
			LoadSprite("Credits/"..idiomas[i].."/Undertale")
		end
	elseif timer == 275 then
		LoadSprite("Credits/GB")
		LoadSprite("Credits/Phase 1")
		LoadSprite("Credits/Phase 2")
		LoadSprite("Credits/Phase 3")
		LoadSprite("Credits/Phase 4")
		for i=1,14 do
			LoadSprite("Death Egg Robot/Eggman/"..i)
		end
	elseif timer == 280 then
		LoadSprite("Death Egg Robot/Eggman/ded")
		for i=1,6 do
			LoadSprite("Death Egg Robot/fingers/"..i)
		end
		LoadSprite("Death Egg Robot/arm")
		LoadSprite("Death Egg Robot/body")
		LoadSprite("Death Egg Robot/elbow arm")
		LoadSprite("Death Egg Robot/elbow leg")
	elseif timer == 290 then
		LoadSprite("Death Egg Robot/foot")
		LoadSprite("Death Egg Robot/hand")
		LoadSprite("Death Egg Robot/head")
		LoadSprite("Death Egg Robot/leg")
		LoadSprite("Death Egg Robot/lenght 1")
		LoadSprite("Death Egg Robot/lenght 2")
		LoadSprite("Distorsion/1")
		LoadSprite("Distorsion/2")
		LoadSprite("Distorsion/3")
	elseif timer == 300 then
		local directions = {"L", "R"}
		for i=1,2 do
			for j=1,6 do
				LoadSprite("Egg Bots/"..directions[i].."/Egg Bot 1-"..j)
			end
			LoadSprite("Egg Bots/"..directions[i].."/Egg Bot 2-1")
			LoadSprite("Egg Bots/"..directions[i].."/Egg Bot 2-2")
		end
	elseif timer == 310 then
		LoadSprite("Egg Dog/Bullets/Body")
		LoadSprite("Egg Dog/Bullets/DogL 1")
		LoadSprite("Egg Dog/Bullets/DogL 2")
		LoadSprite("Egg Dog/Bullets/DogR 1")
		LoadSprite("Egg Dog/Bullets/DogR 2")
		LoadSprite("Egg Dog/Bullets/Egg")
		LoadSprite("Egg Dog/Bullets/Head")
		LoadSprite("Egg Dog/Bullets/Shard 1")
		LoadSprite("Egg Dog/Bullets/Shard 2")
		LoadSprite("Egg Dog/Bullets/Shard 3")
		LoadSprite("Egg Dog/Bullets/Shard 4")
	elseif timer == 315 then
		LoadSprite("Egg Dog/Body")
		LoadSprite("Egg Dog/Death")
		LoadSprite("Egg Dog/Head")
		LoadSprite("Egg Dog/Ouch")
		LoadSprite("Eggs/bottomeggL 1")
		LoadSprite("Eggs/bottomeggL 2")
		LoadSprite("Eggs/bottomeggR 1")
		LoadSprite("Eggs/bottomeggR 2")
		LoadSprite("Eggs/egg 1")
		LoadSprite("Eggs/egg 2")
		LoadSprite("Eggs/topeggL")
		LoadSprite("Eggs/topeggR")
	elseif timer == 320 then
		LoadSprite("Flames/Falling/1")
		LoadSprite("Flames/Falling/2")
		LoadSprite("Flames/Falling/3")
		LoadSprite("Flames/Falling/4")
		for i=1,8 do
			LoadSprite("Flames/Normal/"..i)
		end
	elseif timer == 325 then
		for i=1,2 do
			LoadSprite("Flashbacks/Aaron "..i)
			LoadSprite("Flashbacks/Asgore "..i)
			LoadSprite("Flashbacks/Dogamy "..i)
			LoadSprite("Flashbacks/Dogaressa "..i)
			LoadSprite("Flashbacks/Flowey "..i)
			LoadSprite("Flashbacks/Froggit "..i)
			LoadSprite("Flashbacks/Guard "..i)
			LoadSprite("Flashbacks/Knight "..i)
			LoadSprite("Flashbacks/Madjick "..i)
			LoadSprite("Flashbacks/Mettaton "..i)
			LoadSprite("Flashbacks/Muffet "..i)
			LoadSprite("Flashbacks/Papyrus "..i)
			LoadSprite("Flashbacks/Flowey "..i)
			LoadSprite("Flashbacks/Sans "..i)
			LoadSprite("Flashbacks/Temmie "..i)
			LoadSprite("Flashbacks/Toriel "..i)
			LoadSprite("Flashbacks/Undyne "..i)
			LoadSprite("Flashbacks/Vegetoid "..i)
		end
	elseif timer == 330 then
		LoadSprite("Flashbacks/Papyrus 3")
		LoadSprite("Flashbacks/Papyrus 4")
		LoadSprite("Flashbacks/Sans 3")
		LoadSprite("Flashbacks/Sans 4")
		LoadSprite("Flashbacks/Sans 5")
		LoadSprite("Flashbacks/Sans 6")
		LoadSprite("Flashbacks/Toriel 3")
		LoadSprite("Flashbacks/Undyne 3")
	elseif timer == 340 then
		for i=0,10 do
			LoadSprite("Numbers/"..i)
		end
	elseif timer == 350 then
		LoadSprite("Papyrus/Arms/Block")
		LoadSprite("Papyrus/Arms/Blocking")
		LoadSprite("Papyrus/Arms/Broken")
		LoadSprite("Papyrus/Arms/CrabL")
		LoadSprite("Papyrus/Arms/CrabR")
		LoadSprite("Papyrus/Arms/CrusherL")
		LoadSprite("Papyrus/Arms/CrusherR Inv")
		LoadSprite("Papyrus/Arms/CrusherR")
	elseif timer == 355 then
		LoadSprite("Papyrus/Arms/Crying Left Hand")
		LoadSprite("Papyrus/Arms/Crying Right Hand")
		LoadSprite("Papyrus/Arms/Death Left Hand")
		LoadSprite("Papyrus/Arms/Death Right Hand")
		LoadSprite("Papyrus/Arms/Left Angry Detail")
		LoadSprite("Papyrus/Arms/Left Angry")
		LoadSprite("Papyrus/Arms/Left Hand")
		LoadSprite("Papyrus/Arms/Left Tired 2")
		LoadSprite("Papyrus/Arms/Left Tired Detail")
		LoadSprite("Papyrus/Arms/Left Tired")
		LoadSprite("Papyrus/Arms/Left Tired Detail")
	elseif timer == 360 then
		LoadSprite("Papyrus/Arms/Return")
		LoadSprite("Papyrus/Arms/Returning")
		LoadSprite("Papyrus/Arms/Right Angry")
		LoadSprite("Papyrus/Arms/Right Hand")
		LoadSprite("Papyrus/Arms/Right Tired 2")
		LoadSprite("Papyrus/Arms/Right Tired Inv")
		LoadSprite("Papyrus/Arms/Right Tired")
		LoadSprite("Papyrus/Body/Angry")
		LoadSprite("Papyrus/Body/BackBone")
	elseif timer == 365 then
		LoadSprite("Papyrus/Body/Disbelief")
		LoadSprite("Papyrus/Body/Front Arm")
		LoadSprite("Papyrus/Body/Front")
		LoadSprite("Papyrus/Body/My style")
		LoadSprite("Papyrus/Body/NO!")
		LoadSprite("Papyrus/Body/OUCH!")
		LoadSprite("Papyrus/Body/Suffering")
		LoadSprite("Papyrus/Body/You little...")
		LoadSprite("Papyrus/Body/You'll see")
	elseif timer == 370 then
		LoadSprite("Papyrus/Glow/1")
		LoadSprite("Papyrus/Glow/2")
		LoadSprite("Papyrus/Glow/3")
		LoadSprite("Papyrus/Head/Phase 1/...")
		LoadSprite("Papyrus/Head/Phase 1/Attacking")
		LoadSprite("Papyrus/Head/Phase 1/Believe")
		LoadSprite("Papyrus/Head/Phase 1/Blocking")
		LoadSprite("Papyrus/Head/Phase 1/Crying")
		LoadSprite("Papyrus/Head/Phase 1/Death")
		LoadSprite("Papyrus/Head/Phase 1/Disappointed")
		LoadSprite("Papyrus/Head/Phase 1/Finally!")
		LoadSprite("Papyrus/Head/Phase 1/Forgiving")
	elseif timer == 375 then
		LoadSprite("Papyrus/Head/Phase 1/Missing")
		LoadSprite("Papyrus/Head/Phase 1/Normal")
		LoadSprite("Papyrus/Head/Phase 1/Nyehehehe")
		LoadSprite("Papyrus/Head/Phase 1/Oh")
		LoadSprite("Papyrus/Head/Phase 1/Okay...")
		LoadSprite("Papyrus/Head/Phase 1/OUCH")
		LoadSprite("Papyrus/Head/Phase 1/Regretted")
		LoadSprite("Papyrus/Head/Phase 1/Remembering")
		LoadSprite("Papyrus/Head/Phase 1/Sans...")
		LoadSprite("Papyrus/Head/Phase 1/Sorry")
		LoadSprite("Papyrus/Head/Phase 1/STOP")
	elseif timer == 380 then
		LoadSprite("Papyrus/Head/Phase 1/WAAA~")
		LoadSprite("Papyrus/Head/Phase 1/Wait...")
		LoadSprite("Papyrus/Head/Phase 1/What")
		LoadSprite("Papyrus/Head/Phase 1/Why...")
		LoadSprite("Papyrus/Head/Phase 1/Worried")
		LoadSprite("Papyrus/Head/Phase -1/Let's Begin")
		LoadSprite("Papyrus/Head/Phase -1/Sad")
		LoadSprite("Papyrus/Head/Phase -1/What")
		LoadSprite("Papyrus/Head/Phase -1/Whatever")
		LoadSprite("Papyrus/Head/Phase -1/Why")
		LoadSprite("Papyrus/Head/Phase 2/Cleaning")
	elseif timer == 385 then
		for i=1,10 do
			LoadSprite("Papyrus/Head/Phase 2/Cry"..i)
		end
	elseif timer == 390 then
		LoadSprite("Papyrus/Head/Phase 2/Cute")
		LoadSprite("Papyrus/Head/Phase 2/Determined")
		LoadSprite("Papyrus/Head/Phase 2/ENOUGH!")
		LoadSprite("Papyrus/Head/Phase 2/GET READY!")
		LoadSprite("Papyrus/Head/Phase 2/Great")
		LoadSprite("Papyrus/Head/Phase 2/However")
		LoadSprite("Papyrus/Head/Phase 2/I see")
		LoadSprite("Papyrus/Head/Phase 2/I see2")
		LoadSprite("Papyrus/Head/Phase 2/NYEH HEH HEH!")
		LoadSprite("Papyrus/Head/Phase 2/NYEH!")
	elseif timer == 395 then
		LoadSprite("Papyrus/Head/Phase 2/Nyehehe...")
		LoadSprite("Papyrus/Head/Phase 2/Sans...")
		LoadSprite("Papyrus/Head/Phase 2/Sans2...")
		LoadSprite("Papyrus/Head/Phase 2/Snif")
		LoadSprite("Papyrus/Head/Phase 2/Snif2")
		LoadSprite("Papyrus/Head/Phase 2/Stare")
		LoadSprite("Papyrus/Head/Phase 2/Stare2")
		LoadSprite("Papyrus/Head/Phase 2/Tired")
		LoadSprite("Papyrus/Head/Phase 2/Upseted")
		LoadSprite("Papyrus/Head/Phase 2/Upseted2")
		LoadSprite("Papyrus/Head/Phase 2/Useless")
	elseif timer == 400 then
		LoadSprite("Papyrus/Head/Phase 2/Well...")
		LoadSprite("Papyrus/Head/Phase 2/Well2...")
		LoadSprite("Papyrus/Head/Phase 3/Angry")
		LoadSprite("Papyrus/Head/Phase 3/Disgust")
		LoadSprite("Papyrus/Head/Phase 3/err...")
		LoadSprite("Papyrus/Head/Phase 3/Happy")
		LoadSprite("Papyrus/Head/Phase 3/heh...")
		LoadSprite("Papyrus/Head/Phase 3/Normal 1")
		LoadSprite("Papyrus/Head/Phase 3/Normal 2")
		LoadSprite("Papyrus/Head/Phase 3/Normal 3")
		LoadSprite("Papyrus/Head/Phase 3/nyeh...")
	elseif timer == 405 then
		LoadSprite("Papyrus/Head/Phase 3/Ready")
		LoadSprite("Papyrus/Head/Phase 3/Regreat")
		LoadSprite("Papyrus/Head/Phase 3/Sad")
		LoadSprite("Papyrus/Head/Phase 3/Start1")
		LoadSprite("Papyrus/Head/Phase 3/Start2")
		LoadSprite("Papyrus/Head/Phase 3/Start3")
		LoadSprite("Papyrus/Head/Phase 3/Start4")
		LoadSprite("Papyrus/Head/Phase 3/Thinking")
		LoadSprite("Papyrus/Head/Phase 3/umm...")
		LoadSprite("Papyrus/Head/Phase 4/...")
		LoadSprite("Papyrus/Head/Phase 4/Believe")
		LoadSprite("Papyrus/Head/Phase 4/Come on")
	elseif timer == 410 then
		LoadSprite("Papyrus/Head/Phase 4/Dying 1")
		LoadSprite("Papyrus/Head/Phase 4/Dying 2")
		LoadSprite("Papyrus/Head/Phase 4/Dying 3")
		LoadSprite("Papyrus/Head/Phase 4/HEY!")
		LoadSprite("Papyrus/Head/Phase 4/huh")
		LoadSprite("Papyrus/Head/Phase 4/Look!")
		LoadSprite("Papyrus/Head/Phase 4/NO!")
		LoadSprite("Papyrus/Head/Phase 4/NYEH HEH")
		LoadSprite("Papyrus/Head/Phase 4/nyeh...")
		LoadSprite("Papyrus/Head/Phase 4/Please")
		LoadSprite("Papyrus/Head/Phase 4/Power")
	elseif timer == 415 then
		LoadSprite("Papyrus/Head/Phase 4/Thinking")
		LoadSprite("Papyrus/Head/Phase 4/Tired")
		LoadSprite("Papyrus/Head/Phase 4/WAIT!")
		LoadSprite("Papyrus/Head/Phase 4/Well")
		LoadSprite("Papyrus/Head/Phase 4/YES!")
	elseif timer == 420 then
		for i=0,40 do
			LoadSprite("Papyrus/Legs/Phase 2/"..i)
		end
	elseif timer == 425 then
		for i=0,51 do
			LoadSprite("Papyrus/Legs/Phase 3/"..i)
		end
	elseif timer == 430 then
		LoadSprite("Papyrus/Legs/Begin")
		LoadSprite("Papyrus/Legs/Front")
		LoadSprite("Papyrus/Legs/Given Up")
		LoadSprite("Papyrus/Legs/Normal")
		LoadSprite("Papyrus/Legs/Serious")
		LoadSprite("Papyrus/Angry 1")
		LoadSprite("Papyrus/Angry 2")
		LoadSprite("Papyrus/Dance 1")
		LoadSprite("Papyrus/Dance 2")
		LoadSprite("Papyrus/Disgust 1")
		LoadSprite("Papyrus/Disgust 2")
	elseif timer == 435 then
		LoadSprite("Papyrus/Surprised 1")
		LoadSprite("Papyrus/Surprised 2")
		LoadSprite("Papyrus/Brillo")
		LoadSprite("Papyrus/Death Jaw")
		LoadSprite("Papyrus/Deforme")
		LoadSprite("Papyrus/Distorsion")
		LoadSprite("Papyrus/Ghost")
		LoadSprite("Papyrus/Jaw Dying 1")
		LoadSprite("Papyrus/Jaw Dying 2")
		LoadSprite("Papyrus/Jaw")
		LoadSprite("Papyrus/Papyrus Shadow")
		LoadSprite("Papyrus/Silla")
	elseif timer == 440 then
		LoadSprite("Papyrus/Spaghetti")
		LoadSprite("Sans/Body/Down")
		LoadSprite("Sans/Body/Joking")
		LoadSprite("Sans/Body/Left")
		LoadSprite("Sans/Body/Left-Right")
		LoadSprite("Sans/Body/Right")
		LoadSprite("Sans/Body/Up")
		LoadSprite("Sans/Body/Up-Down")
		LoadSprite("Sans/Head/angry")
		LoadSprite("Sans/Head/Funny")
		LoadSprite("Sans/Head/Joking")
		LoadSprite("Sans/Head/mmm...")
		LoadSprite("Sans/Head/Normal")
	elseif timer == 445 then
		LoadSprite("Sans/Head/Power 1")
		LoadSprite("Sans/Head/Power 2")
		LoadSprite("Sans/Head/Presure")
		LoadSprite("Sans/Head/Sleepy")
		LoadSprite("Sans/Head/Surprised")
		LoadSprite("Sans/Head/Wink")
		LoadSprite("Sans/Head/Worried")
		LoadSprite("Sans/Head/Yawn")
		LoadSprite("Sans/Head/Yummy")
		LoadSprite("Sans/Aura")
		LoadSprite("Sans/NewAura")
		LoadSprite("Sans/Dance 1")
		LoadSprite("Sans/Dance 2")
		LoadSprite("Sans/Joke")
	elseif timer == 450 then
		LoadSprite("Sans/Ketchup")
		LoadSprite("Sans/Legs Joking")
		LoadSprite("Sans/Legs")
		LoadSprite("Sans/Z")
		LoadSprite("Shocks/1")
		LoadSprite("Shocks/2")
		LoadSprite("Shocks/3")
		LoadSprite("Shocks/4")
		LoadSprite("Soul Shards/1")
		LoadSprite("Soul Shards/2")
		LoadSprite("Soul Shards/3")
		LoadSprite("Soul Shards/4")
		LoadSprite("Specials/1")
		LoadSprite("Specials/2")
		LoadSprite("Specials/3")
		LoadSprite("Specials/4")
	elseif timer == 455 then
		LoadSprite("Specials/Alteracion 1")
		LoadSprite("Specials/Alteracion 2")
		LoadSprite("Specials/Alteracion 3")
		LoadSprite("Specials/Alteracion 4")
		LoadSprite("Specials/Alteracion 5")
		LoadSprite("Specials/Background Lines")
		LoadSprite("Specials/Background")
		LoadSprite("Specials/Box")
		LoadSprite("Specials/Ded")
	elseif timer == 460 then
		LoadSprite("Specials/Green Mode")
		LoadSprite("Specials/Flee Spanish")
		LoadSprite("Specials/Flee Russian")
		LoadSprite("Specials/K English")
		LoadSprite("Specials/K Spanish")
		LoadSprite("Specials/K Russian")
		LoadSprite("Specials/Line")
		LoadSprite("Specials/Memory 1")
		LoadSprite("Specials/Memory 2")
		LoadSprite("Specials/Memory 3")
		LoadSprite("Specials/Memory 4")
	elseif timer == 465 then
		LoadSprite("Specials/MISS English")
		LoadSprite("Specials/MISS Spanish")
		LoadSprite("Specials/MISS Russian")
		LoadSprite("Specials/Objetivo")
		LoadSprite("Specials/ParteL")
		LoadSprite("Specials/ParteR")
		LoadSprite("Specials/R English")
		LoadSprite("Specials/R Spanish")
		LoadSprite("Specials/R Russian")
		LoadSprite("Specials/Shield 1")
		LoadSprite("Specials/Shield 2")
	elseif timer == 470 then
		LoadSprite("Specials/Skip")
		LoadSprite("Specials/Soul")
		LoadSprite("Specials/Spare 2 English")
		LoadSprite("Specials/Spare 2 Spanish")
		LoadSprite("Specials/Spare English")
		LoadSprite("Specials/Spare Spanish")
		LoadSprite("Specials/Target 1")
		LoadSprite("Specials/Target 2")
		LoadSprite("target/arrow 1")
		LoadSprite("target/arrow 2")
		LoadSprite("target/arrow 3")
		LoadSprite("target/arrow 4")
	elseif timer == 475 then
		LoadSprite("target/pointer 1")
		LoadSprite("target/pointer 2")
		LoadSprite("target/target 1")
		LoadSprite("target/target 2")
		LoadSprite("target/target 3")
		LoadSprite("Undyne/Head/Hurt")
		LoadSprite("Undyne/Head/Laugh 1")
		LoadSprite("Undyne/Head/Laugh 2")
		LoadSprite("Undyne/Head/Laugh 3")
		LoadSprite("Undyne/Head/Mean Look")
		LoadSprite("Undyne/Head/Normal")
	elseif timer == 480 then
		LoadSprite("Undyne/ArmL")
		LoadSprite("Undyne/ArmR")
		LoadSprite("Undyne/Dress")
		LoadSprite("Undyne/Eye")
		LoadSprite("Undyne/Hair")
		LoadSprite("Undyne/Legs")
		LoadSprite("Undyne/Rafaga 1")
		LoadSprite("Undyne/Rafaga 2")
		LoadSprite("Undyne/Torso")
	elseif timer == 485 then
		LoadSprite("92 HP English")
		LoadSprite("92 HP Spanish")
		LoadSprite("92 HP Russian")
		LoadSprite("Advice English")
		LoadSprite("Advice Spanish")
		LoadSprite("Advice Russian")
		LoadSprite("blackL")
		LoadSprite("blackR")
		LoadSprite("BLOCKED English")
		LoadSprite("BLOCKED Spanish")
		LoadSprite("bomb 1")
		LoadSprite("bomb 2")
		LoadSprite("boom")
	elseif timer == 490 then
		LoadSprite("Chara")
		LoadSprite("Circle")
		LoadSprite("ERR")
		LoadSprite("Flee 1 English")
		LoadSprite("Flee 1 Spanish")
		LoadSprite("Flee 2 English")
		LoadSprite("Flee 2 Spanish")
		LoadSprite("HeartFlee 1")
		LoadSprite("HeartFlee 2")
		LoadSprite("LV 19 English")
		LoadSprite("LV 19 Spanish")
		LoadSprite("LV 19 Russian")
	elseif timer == 495 then
		LoadSprite("Pixel")
		LoadSprite("REPELED English")
		LoadSprite("REPELED Spanish")
		LoadSprite("Rotatory Arena Pixel")
		LoadSprite("Text Part 1 English")
		LoadSprite("Text Part 1 Spanish")
		LoadSprite("Text Part 1v2 English")
		LoadSprite("Text Part 1v2 Spanish")
		LoadSprite("Text Part 2 English")
		LoadSprite("Text Part 2 Spanish")
	elseif timer == 500 then
		LoadSprite("Text Part 2v2 English")
		LoadSprite("Text Part 2v2 Spanish")
		LoadSprite("Specials/TrophyBox")
		LoadSprite("Specials/Mouse")
		LoadSprite("Specials/Arrow")
		LoadSprite("Bullets/Bones/BoneWay")
		LoadSprite("Bullets/Bones/BonesDown")
		LoadSprite("Bullets/Bones/Head4")
		LoadSprite("Bullets/Bones/Body4")
	elseif timer == 504 then
		NewAudio.CreateChannel("Musica")
		NewAudio.PlaySound("Musica", "Believe", true, 0)
	elseif timer == 506 then
		NewAudio.PlaySound("Musica", "Bowsy Music Loop", false, 0)
	elseif timer == 508 then
		NewAudio.PlaySound("Musica", "Death Egg Robot", false, 0)
	elseif timer == 510 then
		NewAudio.PlaySound("Musica", "Game Over", true, 0)
		NewAudio.PlaySound("Musica", "Predummy", true, 0)
	elseif timer == 512 then
		NewAudio.PlaySound("Musica", "choice", true, 0)
		NewAudio.PlaySound("Musica", "Chiptune", true, 0)
	elseif timer == 514 then
		NewAudio.PlaySound("Musica", "Snowdin Town Music Box by Shigurizu Chan", true, 0)
	elseif timer == 516 then
		NewAudio.PlaySound("Musica", "Loop Phase 1", true, 0)
	elseif timer == 518 then
		NewAudio.PlaySound("Musica", "Loop 1 Phase 2", true, 0)
		NewAudio.PlaySound("Musica", "Loop 2 Phase 2", true, 0)
	elseif timer == 520 then
		NewAudio.PlaySound("Musica", "Loop 3 Phase 2", true, 0)
		NewAudio.PlaySound("Musica", "Loop 1 Phase 3", true, 0)
	elseif timer == 522 then
		NewAudio.PlaySound("Musica", "Loop 2 Phase 3", true, 0)
		NewAudio.PlaySound("Musica", "Loop 3 Phase 3", true, 0)
	elseif timer == 524 then
		NewAudio.PlaySound("Musica", "Loop 4 Phase 3", true, 0)
		NewAudio.PlaySound("Musica", "Loop 5 Phase 3", true, 0)
	elseif timer == 526 then
		NewAudio.PlaySound("Musica", "Papyrus", true, 0)
	elseif timer == 528 then
		NewAudio.PlaySound("Musica", "Birds", true, 0)
		NewAudio.PlaySound("Musica", "Goodnight", true, 0)
	elseif timer == 530 then
		NewAudio.PlaySound("Musica", "prejoker", true, 0)
		NewAudio.PlaySound("Musica", "Enemy Aproaching", true, 0)
	elseif timer == 532 then
		NewAudio.PlaySound("Musica", "Ending Phase 1", false, 0)
	elseif timer == 534 then
		NewAudio.PlaySound("Musica", "Once Upon A Time", false, 0)
	elseif timer == 536 then
		NewAudio.PlaySound("Musica", "Megalovania", true, 0)
	elseif timer == 538 then
		NewAudio.PlaySound("Musica", "Dark Darker Yet Darker Remix", false, 0)
	elseif timer == 540 then
		NewAudio.PlaySound("Musica", "The World Revolving Metal Cover", false, 0)
	elseif timer == 542 then
		NewAudio.PlaySound("Musica", "Bowsy Music Intro", false, 0)
		NewAudio.PlaySound("Musica", "cYsmix - Peer Gynt", false, 0)
	elseif timer == 544 then
		NewAudio.PlaySound("Musica", "Intro Phase 2", false, 0)
	elseif timer == 546 then
		NewAudio.PlaySound("Musica", "Intro Death Egg Robot", false, 0)
	elseif timer == 548 then
		NewAudio.PlaySound("Musica", "Intro 1 Phase 2", false, 0)
	elseif timer == 550 then
		NewAudio.PlaySound("Musica", "Intro 2 Phase 2", false, 0)
	elseif timer == 552 then
		NewAudio.PlaySound("Musica", "Intro 3 Phase 2", false, 0)
	elseif timer == 554 then
		NewAudio.PlaySound("Musica", "Intro 4 Phase 2", false, 0)
	elseif timer == 556 then
		NewAudio.PlaySound("Musica", "Intro 1 Phase 3", false, 0)
	elseif timer == 558 then
		NewAudio.PlaySound("Musica", "Intro 2 Phase 3", false, 0)
	elseif timer == 560 then
		NewAudio.PlaySound("Musica", "Intro 3 Phase 3", false, 0)
	elseif timer == 562 then
		NewAudio.PlaySound("Musica", "Intro 4 Phase 3", false, 0)
	elseif timer == 564 then
		NewAudio.PlaySound("Musica", "Intro 5 Phase 3", false, 0)
	elseif timer == 566 then
		NewAudio.PlaySound("Musica", "Intro 6 Phase 3", false, 0)
	elseif timer == 568 then
		NewAudio.PlaySound("Musica", "Phase 4", false, 0)
	elseif timer == 570 then
		NewAudio.PlaySound("Musica", "Intro Phase 1 Short", false, 0)
		NewAudio.PlaySound("Musica", "Intro Phase 1", false, 0)
	elseif timer == 572 then
		NewAudio.PlaySound("Musica", "Zef - Tension", false, 0)
	elseif timer == 574 then
		NewAudio.PlaySound("Musica", "Bonetrousle - Megalovania Piano", false, 0)
		NewAudio.Stop("Musica")
		NewAudio.DestroyChannel("Musica")
	elseif timer == 576 then
		NewAudio.CreateChannel("Sounds")
		NewAudio.PlaySound("Sounds", "bark", false, 0)
		NewAudio.PlaySound("Sounds", "begin", false, 0)
		NewAudio.PlaySound("Sounds", "Bomb", false, 0)
	elseif timer == 577 then
		NewAudio.PlaySound("Sounds", "BombExplotion", false, 0)
		NewAudio.PlaySound("Sounds", "BossHit", false, 0)
		NewAudio.PlaySound("Sounds", "bouncePlat", false, 0)
		NewAudio.PlaySound("Sounds", "bouncePlat2", false, 0)
	elseif timer == 578 then
		NewAudio.PlaySound("Sounds", "bounceWall", false, 0)
		NewAudio.PlaySound("Sounds", "bounceWall2", false, 0)
		NewAudio.PlaySound("Sounds", "bowsydead", false, 0)
		NewAudio.PlaySound("Sounds", "bowsypoundhelikoopa", false, 0)
	elseif timer == 579 then
		NewAudio.PlaySound("Sounds", "Buzzsaw", false, 0)
		NewAudio.PlaySound("Sounds", "bye bye", false, 0)
		NewAudio.PlaySound("Sounds", "chaos CHAOS", false, 0)
	elseif timer == 580 then
		NewAudio.PlaySound("Sounds", "checkpoint", false, 0)
		NewAudio.PlaySound("Sounds", "closet impact", false, 0)
		NewAudio.PlaySound("Sounds", "confirm", false, 0)
		NewAudio.PlaySound("Sounds", "Congratulations", false, 0)
	elseif timer == 581 then
		NewAudio.PlaySound("Sounds", "damage", false, 0)
		NewAudio.PlaySound("Sounds", "dead2", false, 0)
		NewAudio.PlaySound("Sounds", "Dead", false, 0)
		NewAudio.PlaySound("Sounds", "DevilsKnife", false, 0)
	elseif timer == 582 then
		NewAudio.PlaySound("Sounds", "ding", false, 0)
		NewAudio.PlaySound("Sounds", "Distorsion", false, 0)
		NewAudio.PlaySound("Sounds", "Drill", false, 0)
		NewAudio.PlaySound("Sounds", "Drop", false, 0)
	elseif timer == 583 then
		NewAudio.PlaySound("Sounds", "dust", false, 0)
		NewAudio.PlaySound("Sounds", "encounter", false, 0)
		NewAudio.PlaySound("Sounds", "error", false, 0)
		NewAudio.PlaySound("Sounds", "explode", false, 0)
	elseif timer == 584 then
		NewAudio.PlaySound("Sounds", "Explosion3", false, 0)
		NewAudio.PlaySound("Sounds", "fallingbomb", false, 0)
		NewAudio.PlaySound("Sounds", "Fireball", false, 0)
	elseif timer == 585 then
		NewAudio.PlaySound("Sounds", "flee", false, 0)
		NewAudio.PlaySound("Sounds", "Game Over Paps", false, 0)
	elseif timer == 586 then
		NewAudio.PlaySound("Sounds", "gasterfire", false, 0)
		NewAudio.PlaySound("Sounds", "gasterintro", false, 0)
		NewAudio.PlaySound("Sounds", "gasterintro2", false, 0)
		NewAudio.PlaySound("Sounds", "gasterintrofast", false, 0)
	elseif timer == 587 then
		NewAudio.PlaySound("Sounds", "gastervibration", false, 0)
		NewAudio.PlaySound("Sounds", "HAHAHAHA", false, 0)
		NewAudio.PlaySound("Sounds", "HappyDamage", false, 0)
		NewAudio.PlaySound("Sounds", "HappyDust", false, 0)
	elseif timer == 588 then
		NewAudio.PlaySound("Sounds", "HappyExplotion", false, 0)
		NewAudio.PlaySound("Sounds", "HappySlice", false, 0)
		NewAudio.PlaySound("Sounds", "healsound", false, 0)
		NewAudio.PlaySound("Sounds", "heavydamage", false, 0)
	elseif timer == 589 then
		NewAudio.PlaySound("Sounds", "hit", false, 0)
		NewAudio.PlaySound("Sounds", "hitBowsy", false, 0)
		NewAudio.PlaySound("Sounds", "hitshells", false, 0)
		NewAudio.PlaySound("Sounds", "hitsound", false, 0)
	elseif timer == 590 then
		NewAudio.PlaySound("Sounds", "HullClose", false, 0)
		NewAudio.PlaySound("Sounds", "hurt", false, 0)
		NewAudio.PlaySound("Sounds", "hurtsound", false, 0)
		NewAudio.PlaySound("Sounds", "I can do anything", false, 0)
	elseif timer == 591 then
		NewAudio.PlaySound("Sounds", "impact", false, 0)
		NewAudio.PlaySound("Sounds", "Impact2", false, 0)
		NewAudio.PlaySound("Sounds", "gasterintro2", false, 0)
	elseif timer == 592 then
		NewAudio.PlaySound("Sounds", "Impact6", false, 0)
		NewAudio.PlaySound("Sounds", "jump", false, 0)
		NewAudio.PlaySound("Sounds", "laugh1", false, 0)
		NewAudio.PlaySound("Sounds", "laugh2", false, 0)
	elseif timer == 593 then
		NewAudio.PlaySound("Sounds", "laugh3", false, 0)
		NewAudio.PlaySound("Sounds", "LedgeBreak", false, 0)
		NewAudio.PlaySound("Sounds", "LedgeBreak2", false, 0)
	elseif timer == 594 then
		NewAudio.PlaySound("Sounds", "logro", false, 0)
		NewAudio.PlaySound("Sounds", "lol You died", false, 0)
		NewAudio.PlaySound("Sounds", "MultiBone", false, 0)
	elseif timer == 595 then
		NewAudio.PlaySound("Sounds", "NEO chaos", false, 0)
		NewAudio.PlaySound("Sounds", "mysterious", false, 0)
		NewAudio.PlaySound("Sounds", "nothing", false, 0)
		NewAudio.PlaySound("Sounds", "OH", false, 0)
	elseif timer == 596 then
		NewAudio.PlaySound("Sounds", "Pon", false, 0)
		NewAudio.PlaySound("Sounds", "pierce", false, 0)
		NewAudio.PlaySound("Sounds", "pip", false, 0)
		NewAudio.PlaySound("Sounds", "poundbigbomb", false, 0)
	elseif timer == 597 then
		NewAudio.PlaySound("Sounds", "poundbomb", false, 0)
		NewAudio.PlaySound("Sounds", "ring", false, 0)
		NewAudio.PlaySound("Sounds", "roughhit", true, 0)
	elseif timer == 598 then
		NewAudio.PlaySound("Sounds", "save", false, 0)
		NewAudio.PlaySound("Sounds", "scream", false, 0)
		NewAudio.PlaySound("Sounds", "shootbomb", true, 0)
	elseif timer == 599 then
		NewAudio.PlaySound("Sounds", "slam", true, 0)
		NewAudio.PlaySound("Sounds", "slice", false, 0)
		NewAudio.PlaySound("Sounds", "sparkle", false, 0)
		NewAudio.PlaySound("Sounds", "sparkleslow", true, 0)
	elseif timer == 600 then
		NewAudio.PlaySound("Sounds", "spawn", false, 0)
		NewAudio.PlaySound("Sounds", "spearswing", false, 0)
		NewAudio.PlaySound("Sounds", "st", false, 0)
	elseif timer == 601 then
		NewAudio.PlaySound("Sounds", "start", false, 0)
		NewAudio.PlaySound("Sounds", "suspenso", true, 0)
		NewAudio.PlaySound("Sounds", "Targeting1", true, 0)
	elseif timer == 602 then
		NewAudio.PlaySound("Sounds", "throw", false, 0)
		NewAudio.PlaySound("Sounds", "throwfire", true, 0)
		NewAudio.PlaySound("Sounds", "throwthings", true, 0)
	elseif timer == 603 then
		NewAudio.PlaySound("Sounds", "toss", true, 0)
		NewAudio.PlaySound("Sounds", "ueeueeueeuee", true, 0)
		NewAudio.PlaySound("Sounds", "uh", true, 0)
	elseif timer == 604 then
		NewAudio.PlaySound("Sounds", "wow", true, 0)
		NewAudio.PlaySound("Sounds", "Voices/asgore", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/chara", false, 0)
	elseif timer == 605 then
		NewAudio.PlaySound("Sounds", "Voices/determined papyrus", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/mad papyrus", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/monster", false, 0)
	elseif timer == 606 then
		NewAudio.PlaySound("Sounds", "Voices/papyrus loud", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/papyrus pitched", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/papyrus", false, 0)
	elseif timer == 607 then
		NewAudio.PlaySound("Sounds", "Voices/sans fast", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/ui", false, 0)
		NewAudio.PlaySound("Sounds", "Voices/undyne", false, 0)
		NewAudio.Stop("Sounds")
		NewAudio.DestroyChannel("Sounds")
	elseif timer > 630 and timer <= 660 then
		Preview.alpha = 1 - 0.5/30*(660 - timer)
		Texto1.alpha = 1/30*(660 - timer)
		ProgressBox.alpha = 1/30*(660 - timer)
		ProgressBar.alpha = 1/30*(660 - timer)
	elseif timer > 690 and timer <= 930 then
		Preview.Scale(640/1020*(100 - 99/240*(930 - timer)), 640/1020*(100 - 99/240*(930 - timer)))
		Preview.MoveTo(320, 5240 - 5000/240*(930 - timer))
	end
	if timer > 130 and timer <= 600 then
		ProgressBar.xscale = 570/470*(timer - 130)
		ProgressBar.color = {(50 + 50*math.sin(math.rad(30*timer)))/255, 1, (50 + 50*math.sin(math.rad(30*timer)))/255}
	end
	if timer >= 990 then
		Black.Remove()
		Preview.Remove()
		ProgressBar.layer = "BelowPlayer"
		ProgressBar.Remove()
		ProgressBox.Remove()
		Texto1.Remove()
		Encounter["nextwaves"] = {"Hold on"}
		State("DEFENDING")
	end
end

function LoadSprite(sprite)
	Cargador = CreateSprite(sprite)
	Cargador.Remove()
	Cargador = nil
end