timer = 0

Black = CreateSprite("Pixel","Top")
Black.MoveTo(320, 240)
Black.Scale(640, 480)
Black.color = {0,0,0}
SkipBlack = CreateSprite("Pixel","Top")
SkipBlack.MoveTo(320, 240)
SkipBlack.Scale(640, 480)
SkipBlack.color = {0,0,0}
SkipBlack.alpha = 0
NewAudio.CreateChannel("Diapositivas")

function Update()
	timer = timer + 1
	if timer == 60 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Disclaimer = CreateText("[instant][novoice][font:uidialog]     DESCARGO", {0, 0}, 800, "Top")
			Texto = CreateText("[instant][novoice][font:uidialog]Este mod no es oficial, es una recreación de la animación original de FlamesAtGames, sin su animación, este mod jamás hubiera existido\n\nDeberian estar agradeciendo a FlamesAtGames por esto, vayan a apoyar su recreación original de la animación.\n\nDisbelief de Liquid Mog propiedad de FlamesAtGames.\nUndertale hecho por Toby Fox.", {0, 0}, 620, "Top")
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Disclaimer = CreateText("[instant][novoice][font:uidialog]     ВНИМАНИЕ", {0, 0}, 800, "Top")
			Texto = CreateText("[instant][novoice][font:uidialog]Это не официальная модификация, она воссоздана по анимации от FlamesAtGames, без его анимации, этот мод бы никогда бы не существовал.\n\nВам следует поблагодарить FlamesAtGames за это, поддержите его официальную игру.\n\nDisbelief от Liquid Mog собственность FlamesAtGames.\nАвтор Undertale - Toby Fox.", {0, 0}, 600, "Top")
		else
			Disclaimer = CreateText("[instant][novoice][font:uidialog]    DISCLAIMER", {0, 0}, 800, "Top")
			Texto = CreateText("[instant][novoice][font:uidialog]This mod is not official, it's a recreation of the original animation of FlamesAtGames, without his animation, this mod would never have existed.\n\nYou should be thanking FlamesAtGames for this, go support his original recreation of the animation.\n\nDisbelief by Liquid Mog owned by FlamesAtGames.\nUndertale by Toby Fox.", {0, 0}, 620, "Top")
		end
		Disclaimer.alpha = 0
		Disclaimer.progressmode = "none"
		Disclaimer.MoveTo(20, 420)
		Disclaimer.Scale(2,2)
		Disclaimer.HideBubble()
		Texto.alpha = 0
		Texto.progressmode = "none"
		Texto.MoveTo(20, 360)
		Texto.HideBubble()
	elseif timer > 60 and timer <= 90 then
		Disclaimer.alpha = 1/30*(timer - 60)
		Texto.alpha = 1/30*(timer - 60)
	elseif timer > 390 and timer <= 450 then
		Disclaimer.alpha = 1/30*(450 - timer)
		Texto.alpha = 1/30*(450 - timer)
	elseif timer == 451 then
		Disclaimer.Remove()
		Texto.Remove()
		Disclaimer = nil
		Texto = nil
	elseif timer == 511 then
		NewAudio.PlaySound("Diapositivas", "Once Upon A Time", false, 1)
		Square = CreateSprite("Pixel", "Top")
		Square.Scale(400, 220)
		Square.MoveTo(320, 314)
		Square.Mask("stencil")
		Diapo = CreateSprite("Specials/Dia0 "..GetAlMightyGlobal("Idioma"))
		Diapo.SetParent(Square)
		Diapo.MoveTo(0, 0)
		Diapo.alpha = 0
	elseif timer > 540 and timer <= 570 then
		Diapo.alpha = 1/30*(timer - 540)
	elseif timer > 753 and timer <= 783 then
		Diapo.alpha = 1/30*(783 - timer)
		if timer == 783 then
			Diapo.Set("Specials/Dia1 "..GetAlMightyGlobal("Idioma"))
		end
	elseif timer > 803 and timer <= 833 then
		Diapo.alpha = 1/30*(timer - 803)
	elseif timer > 1036 and timer <= 1066 then
		Diapo.alpha = 1/30*(1066 - timer)
		if timer == 1066 then
			Diapo.Set("Specials/Dia2")
		end
	elseif timer > 1086 and timer <= 1116 then
		Diapo.alpha = 1/30*(timer - 1086)
	elseif timer > 1340 and timer <= 1370 then
		Diapo.alpha = 1/30*(1370 - timer)
		if timer == 1370 then
			Diapo.Set("Specials/Dia3")
		end
	elseif timer > 1390 and timer <= 1420 then
		Diapo.alpha = 1/30*(timer - 1390)
		if timer == 1391 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto = CreateText("[font:uidialog][speed:1.25]Muchas rutas genocidas se han hecho una y otra vez.", {80, 130}, 500, "Top")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto = CreateText("[font:uidialog][speed:1.25]Множество путей геноцида были пройдены раз за разом.", {80, 130}, 500, "Top")
			else
				Texto = CreateText("[font:uidialog][speed:1.25]Many genocides routes have been played over and over.", {80, 130}, 500, "Top")
			end
			Texto.progressmode = "none"
			Texto.HideBubble()
		end
	elseif timer > 1563 and timer <= 1593 then
		Diapo.alpha = 1/30*(1593 - timer)
		if timer == 1593 then
			Diapo.Set("Specials/Dia4")
		end
	elseif timer > 1613 and timer <= 1643 then
		Diapo.alpha = 1/30*(timer - 1613)
		if timer == 1614 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto.SetText("[font:uidialog][speed:1.25]El humano está acostumbrado a encontrarse con Papyrus en la última habitación de Snowdin.")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto.SetText("[font:uidialog][speed:1.25]Человек уже привык ко встрече с Папирусом в конце Сноудина.")
			else
				Texto.SetText("[font:uidialog][speed:1.25]The human is used to meeting Papyrus at the last room of Snowdin.")
			end
		end
	elseif timer > 1810 and timer <= 1840 then
		Diapo.alpha = 1/30*(1840 - timer)
		if timer == 1840 then
			Diapo.Set("Specials/Dia5")
		end
	elseif timer > 1860 and timer <= 1890 then
		Diapo.alpha = 1/30*(timer - 1860)
		if timer == 1861 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto.SetText("[font:uidialog][speed:1.25]Pero en cambio[w:5], se encontró con un viejo amigo que no se suponía que vería todavía.")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto.SetText("[font:uidialog][speed:1.25]Но в этот раз[w:5], он встретил старого друга[w:5], с которым он не должен был пока столкнуться.")
			else
				Texto.SetText("[font:uidialog][speed:1.25]But instead[w:5], they met an old friend that wasn't supposed to be seen yet.")
			end
		end
	elseif timer > 2205 and timer <= 2235 then
		Diapo.alpha = 1/30*(2235 - timer)
		Texto.alpha = 1/30*(2235 - timer)
		if timer == 2235 then
			Diapo.Set("Specials/Dia6")
			Square.MoveTo(320, 166)
		end
	elseif timer > 2255 and timer <= 2285 then
		Diapo.alpha = 1/30*(timer - 2255)
		if timer == 2256 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto.SetText("[font:uidialog][speed:1.25]Sans se había cansado de ver al humano matar a todos los que amaba una y otra vez.")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto.SetText("[font:uidialog][speed:1.25]Сансу уже надоело видеть[w:5], как человек раз за разом убивает всех, кого он любил.")
			else
				Texto.SetText("[font:uidialog][speed:1.25]Sans had gotten sick of watching the human kill everyone he loved over and over again.")
			end
			Texto.alpha = 1
			Texto.MoveTo(80, 390)
		end
	elseif timer > 2669 and timer <= 2699 then
		Diapo.alpha = 1/30*(2699 - timer)
		if timer == 2699 then
			Diapo.Set("Specials/Dia7")
		end
	elseif timer > 2719 and timer <= 2749 then
		Diapo.alpha = 1/30*(timer - 2719)
		if timer == 2720 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto.SetText("[font:uidialog][speed:1.25]El humano comenzó otra ruta de genocida[w:4], y Sans estaba impaciente.")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto.SetText("[font:uidialog][speed:1.25]Человек снова начал путь геноцида[w:10], чем Санс был весьма недоволен.")
			else
				Texto.SetText("[font:uidialog][speed:1.25]The human started a new genocide route[w:5], and Sans was impatient.")
			end
		end
	elseif timer > 2828 and timer <= 2858 then
		if timer == 2829 then
			Diapo2 = CreateSprite("Specials/Dia8")
			Diapo2.SetParent(Square)
			Diapo2.MoveTo(0, 0)
		end
		Diapo2.alpha = 1/30*(timer - 2828)
	elseif timer > 3065 and timer <= 3311 then
		NewAudio.SetVolume("Diapositivas", 1/246*(3311 - timer))
		if timer == 3311 then
			NewAudio.Stop("Diapositivas")
		end
		if timer > 3100 and timer <= 3130 then
			Diapo.alpha = 1/30*(3130 - timer)
			Diapo2.alpha = 1/30*(3130 - timer)
			Texto.alpha = 1/30*(3130 - timer)
			if timer == 3130 then
				Diapo.Set("Specials/Dia9")
				Diapo.MoveTo(0, 190)
				Square.MoveTo(320, 314)
				Diapo2.layer = "BelowPlayer"
				Diapo2.Remove()
				Diapo2 = nil
			end
		elseif timer == 3150 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto.SetText("[font:uidialog][speed:1.25]El no quería volver a ver el polvo de su propio hermano de nuevo.")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto.SetText("[font:uidialog][speed:1.25]Он не хотел видеть пыль своего брата вновь.")
			else
				Texto.SetText("[font:uidialog][speed:1.25]He didn't want to see the dust of his own brother again.")
			end
			Texto.alpha = 1
			Texto.MoveTo(80, 260)
		end
	elseif timer == 3430 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Texto.SetText("[font:uidialog][speed:1.25]Así que detuvo a Papyrus de intentar capturar al humano en Snowdin.")
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Texto.SetText("[font:uidialog][speed:1.25]Так что он остановил Папируса от попыток поймать человека в Сноудине.")
		else
			Texto.SetText("[font:uidialog][speed:1.25]So he stopped Papyrus from trying to capture the human in Snowdin.")
		end
	elseif timer > 3635 and timer <= 3665 then
		Texto.alpha = 1/30*(3665 - timer)
	elseif timer == 3685 then
		Diapo.alpha = 1
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Texto.SetText("[font:uidialog]Y se encargó de ello él mismo.")
			Texto.MoveTo(100, 130)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Texto.SetText("[font:uidialog]И решил разобраться с человеком самостоятельно.")
			Texto.MoveTo(80, 130)
		else
			Texto.SetText("[font:uidialog]And took care of it himself.")
			Texto.MoveTo(100, 130)
		end
		Texto.alpha = 1
		NewAudio.PlaySound("Diapositivas", "Megalovania", true, 1)
		NewAudio.SetPlayTime("Diapositivas", 16)
		Shaker = {0, 0}
	elseif timer > 3685 and timer <= 3970 then
		if timer%2 == 0 then
			Shaker = {math.random(-3,3), math.random(-3,3)}
		end
		Diapo.MoveTo(Shaker[1], 190 - 380/285*(timer - 3685) + Shaker[2])
	elseif timer == 3971 then
		Diapo.layer = "BelowPlayer"
		Diapo.Remove()
		Square.Remove()
		Diapo = nil
		Square = nil
		Texto.alpha = 0
	elseif timer == 4000 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Texto.SetText("[font:uidialog]Pero murió.")
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Texto.SetText("[font:uidialog]Но он погиб.")
		else
			Texto.SetText("[font:uidialog]But he died.")
		end
		Texto.alpha = 1
		Texto.MoveTo(220, 240)
	elseif timer > 4090 and timer <= 4510 then
		NewAudio.SetVolume("Diapositivas", 1/420*(4510 - timer))
		if timer == 4091 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Texto.SetText("[font:uidialog]Y Papyrus ahora era el que vería morir a sus amigos.")
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Texto.SetText("[font:uidialog]И теперь Папирусу пришлось смотреть на то[w:5], как его друзья погибают.")
			else
				Texto.SetText("[font:uidialog]And Papyrus was now the one to watch his friends die.")
			end
			Texto.MoveTo(80, 260)
		elseif timer > 4390 and timer <= 4510 then
			Texto.alpha = 1/120*(4510 - timer)
		end
	elseif timer == 4511 and not Skip then
		NewAudio.Stop("Diapositivas")
	elseif timer == 4601 and not Skip then
		Audio.PlaySound("suspenso")
		Logo = CreateSprite("Menu/Disbelief","Top")
		Logo.Scale(0.6, 0.6)
		Logo.MoveTo(320, 260)
	elseif timer == 4720 and not Skip then
		if not Texto then
			Texto = CreateText("[novoice]idk", {0, 0}, 500, "Top")
			Texto.progressmode = "none"
			Texto.HideBubble()
		end
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Texto.SetText("[instant][novoice][font:uidialog](Presiona Z o Enter)")
			Texto.MoveTo(170, 100)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Texto.SetText("[instant][novoice][font:uidialog](Нажмите Z или Enter)")
			Texto.MoveTo(165, 100)
		else
			Texto.SetText("[instant][novoice][font:uidialog](Press Z or Enter)")
			Texto.MoveTo(180, 100)
		end
		Texto.alpha = 1
		Texto.color = {0.25, 0.25, 0.25}
	elseif timer > 4720 and Input.Confirm == 1 and not Skip and not Finish then
		Finish = 0
	end
	SkipBlack.SendToTop()
	if (Input.Confirm == 1 or Input.Cancel == 1) and not Skip and timer > 511 and timer <= 4510 then
		Skip = 0
	elseif Skip then
		Skip = Skip + 1
		if Skip > 0 and Skip <= 120 then
			NewAudio.SetVolume("Diapositivas", math.min(1/120*(120 - Skip), NewAudio.GetVolume("Diapositivas")))
			SkipBlack.alpha = 1/120*Skip
		elseif Skip > 120 then
			Skip = nil
			SkipBlack.alpha = 0
			if Diapo2 then
				Diapo2.layer = "BelowPlayer"
				Diapo2.Remove()
				Diapo2 = nil
			end
			if Diapo then
				Diapo.layer = "BelowPlayer"
				Diapo.Remove()
				Diapo = nil
			end
			if Square then
				Square.Remove()
				Square = nil
			end
			if Texto then
				Texto.SetText("[instant][novoice][font:uidialog]Nothing")
				Texto.alpha = 0
			end
			timer = 4510
		end
	end
	if Finish then
		Finish = Finish + 1
		if Finish == 1 then
			Texto.Remove()
			Logo.Remove()
		elseif Finish == 61 then
			Black.Remove()
			SkipBlack.Remove()
			NewAudio.DestroyChannel("Diapositivas")
			Encounter["nextwaves"] = {"Menu"}
			State("DEFENDING")
		end
	end
end