require "Dialogs"
Arena.Resize(565, 130)
Encounter.Call("SetHead", "Upseted2")
Player.sprite.alpha = 0
Player.SetControlOverride(true)
Huesotototes = {CreateProjectileAbs("Bullets/Bones/Special", -86, 105, "BelowPlayer"), CreateProjectileAbs("Bullets/Bones/Special", 0, 0), CreateProjectileAbs("Bullets/Bones/Special", 0, 0), CreateProjectileAbs("Bullets/Bones/Special", 0, 0), CreateProjectileAbs("Bullets/Bones/Special", 0, 0)}
for i=1,#Huesotototes do
	Huesotototes[i].sprite.alpha = 0
	if i ~= 1 then
		Huesotototes[i].sprite.SetParent(Huesotototes[1].sprite)
		Huesotototes[i].sprite.MoveTo(168*(i - 1), 0)
	end
	Huesotototes[i].SetVar("No Damage", true)
end
PosX = -86

state = 0
maxjump = 40
jump = 0
newpX = Player.absx
newpY = Player.absy
tableaux = 0
AuxX = 320
PlatX = 320
PlatY = 92
PapsX = 320
BFX = 87
BAX = 240
BIX = 400
BMX = 555
phases = {-90, 0}
Limite = 320
timer = 0

SetPPCollision(true)

GBPaps = {}
Bones1 = {}
Zoom = {}
ZoomBone = {}

function RecolorSoul()
	if state ~= 1 and state ~= 2 then
		Player.sprite.color = {1.0,0.0,0.0}
		Player.sprite.rotation = 0
	elseif state == 1 or state == 2 then
		Player.sprite.color = {0,60/255,1}
		Player.sprite.rotation = 0
	end
end

RecolorSoul()

function Update()
	DialogUpdate()
	if phases[1] == -90 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Dialog("[noskip][waittall:0.5]De repente[w:5], empiezas a recordar.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Dialog("[noskip][waittall:0.5]Внезапно[w:5] вы начинаете вспоминать.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
		else
			Dialog("[noskip][waittall:0.5]Suddenly[w:5], you start to remember.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
		end
		phases[1] = -89
		ForceContinue = true
	end
	if Encounter["GameMusic"] ~= "Loop 3" then
		if phases[1] > -90 and phases[1] <= 0 then
			if everything then
				phases[1] = 1
			else
				phases[1] = phases[1] + 1
			end
		elseif (NewAudio.GetPlayTime("One") > 0 or everything) and phases[1] == 1 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Dialog("[noskip][waittall:0.5]Todas esa líneas temporales.\nTodas esas citas.\nTodas esas amistades.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Dialog("[noskip][waittall:0.5]Все эти временные линии.\nВсе эти свидания.\nВаших друзей.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			else
				Dialog("[noskip][waittall:0.5]All those timelines.[w:3]\nAll those dates.[w:3]\nAll those friendships.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			end
			phases[1] = 2
		elseif (NewAudio.GetPlayTime("One") > 2.71 or everything) and phases[1] == 2 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Dialog("[noskip][waittall:0.5]Vamos[w:5], no las extrañas.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Dialog("[noskip][waittall:0.5]Да ладно[w:5], ты же по ним не\rскучаешь.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			else
				Dialog("[noskip][waittall:0.5]Come now[w:5], you don't miss them.[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			end
			phases[1] = 3
		elseif (NewAudio.GetPlayTime("One") > 4.57 or everything) and phases[1] == 3 then
			Encounter.Call("AttackAnim", 1)
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Dialog("[noskip][waittall:0.5][voice:chara][starcolor:ff0000][color:ff0000]Si[MoveX:20]no[MoveX:20]por[MoveX:20]qué[MoveX:20]estaríamos[MoveX:20]aquí?[MoveX:20]=)[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Dialog("[noskip][waittall:0.5][voice:chara][starcolor:ff0000][color:ff0000]Иначе почему мы здесь? =)[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			else
				Dialog("[noskip][waittall:0.5][voice:chara][starcolor:ff0000][color:ff0000]Why else would we be here? =)[w:1000000] ", {X = 91, Y = 210}, nil, true, 1)
			end
			phases[1] = 4
		elseif (NewAudio.GetPlayTime("One") > 5.63 or everything) and phases[1] == 4 then 
			table.insert(GBPaps, {Sprite = CreateSprite("Bullets/GB Papyrus/0","Top"), Animacion = {DatosIniciales = {X = -38, Y = 530, rotation = 0}, DatosFinales = {X = 555, Y = 100, rotation = -90}, VelAppearing = 40}, Delay = 29, Duration = 20, Bones = true})
			Audio.PlaySound("gasterintro")
			phases[1] = 5
		elseif (NewAudio.GetPlayTime("One") > 6.24 or everything) and phases[1] == 5 then
			Dialog("", {0, 0}, nil, nil, 1)
			Arena.Resize(220, 130)
			Player.sprite.alpha = 1
			state = 1
			RecolorSoul()
			phases[1] = 6
		elseif (NewAudio.GetPlayTime("One") > 7 or everything) and phases[1] == 6 then
			if not Plataforma then
				Plataforma = CreateProjectileAbs("Bullets/Platforms/70", PlatX, PlatY, "BelowPlayer")
				Plataforma.SetVar("Plataforma", true)
				Plataforma.ppcollision = false
			end
			if NewAudio.GetPlayTime("One") <= 7.39 and PlatY < 136 and not everything then
				VelY = 4
			else
				VelY = nil
				PlatY = 136
				phases[1] = 7
			end
		elseif (NewAudio.GetPlayTime("One") > 7.7 or everything) and phases[1] == 7 then
			if NewAudio.GetPlayTime("One") <= 12.68 and not everything then
				VelX = (320 - 70*math.sin(math.rad(540/4.98*(NewAudio.GetPlayTime("One") - 7.7)))) - Plataforma.absx
			else
				VelX = 320 - Plataforma.absx
				phases[1] = 8
			end
		elseif phases[1] == 8 then
			VelX = nil
			phases[1] = 9
		elseif (NewAudio.GetPlayTime("One") > 13.1 or everything) and phases[1] == 9 then
			Audio.PlaySound("ding")
			Plataforma.sprite.Set("Bullets/Magical Platforms/70")
			Plataforma.SetVar("No Move", true)
			if OnPlatform then
				OnSpecialPlatform = true
				OnPlatform = nil
			end
			spruait = CreateSprite("Bullets/Magical Platforms/70","Top")
			spruait.MoveToAbs(320, 136)
			table.insert(Zoom, spruait)
			phases[1] = 10
		elseif (NewAudio.GetPlayTime("One") > 13.53 or everything) and phases[1] == 10 then
			if NewAudio.GetPlayTime("One") <= 15 and not everything then
				VelX = (320 + 20*math.sin(math.rad(1080/1.47*(NewAudio.GetPlayTime("One") - 13.53)))) - Plataforma.absx
			else
				VelX = 320 - Plataforma.absx
				phases[1] = 11
			end
		elseif phases[1] == 11 then
			VelX = nil
			phases[1] = 12
		elseif (NewAudio.GetPlayTime("One") > 15.24 or everything) and phases[1] == 12 then
			Audio.PlaySound("ding")
			Plataforma.sprite.Set("Bullets/Platforms/70")
			Plataforma.SetVar("No Move", nil)
			if OnSpecialPlatform then
				OnPlatform = true
				OnSpecialPlatform = nil
			end
			spruait = CreateSprite("Bullets/Platforms/70","Top")
			spruait.MoveToAbs(320, 136)
			table.insert(Zoom, spruait)
			phases[1] = 13
		elseif (NewAudio.GetPlayTime("One") > 15.62 or everything) and phases[1] == 13 then
			if NewAudio.GetPlayTime("One") <= 17.64 and not everything then
				VelX = (320 + 20*math.sin(math.rad(1440/2.02*(NewAudio.GetPlayTime("One") - 15.62)))) - Plataforma.absx
			else
				VelX = 320 - Plataforma.absx
				phases[1] = 14
			end
		elseif phases[1] == 14 then
			VelX = nil
			phases[1] = 15
		elseif (NewAudio.GetPlayTime("One") > 18.33 or everything) and phases[1] == 15 then
			Audio.PlaySound("ding")
			Plataforma.sprite.Set("Bullets/Magical Platforms/70")
			Plataforma.SetVar("No Move", true)
			if OnPlatform then
				OnSpecialPlatform = true
				OnPlatform = nil
			end
			spruait = CreateSprite("Bullets/Magical Platforms/70","Top")
			spruait.MoveToAbs(Plataforma.absx, 136)
			table.insert(Zoom, spruait)
			phases[1] = 16
		elseif (NewAudio.GetPlayTime("One") > 18.73 or everything) and phases[1] == 16 then
			Audio.PlaySound("ding")
			Plataforma.sprite.Set("Bullets/Platforms/70")
			Plataforma.SetVar("No Move", nil)
			if OnSpecialPlatform then
				OnPlatform = true
				OnSpecialPlatform = nil
			end
			spruait = CreateSprite("Bullets/Platforms/70","Top")
			spruait.MoveToAbs(Plataforma.absx, 136)
			table.insert(Zoom, spruait)
			phases[1] = 17
		elseif (NewAudio.GetPlayTime("One") > 19.13 or everything) and phases[1] == 17 then
			Audio.PlaySound("ding")
			Plataforma.sprite.Set("Bullets/Magical Platforms/70")
			Plataforma.SetVar("No Move", true)
			if OnPlatform then
				OnSpecialPlatform = true
				OnPlatform = nil
			end
			spruait = CreateSprite("Bullets/Magical Platforms/70","Top")
			spruait.MoveToAbs(Plataforma.absx, 136)
			table.insert(Zoom, spruait)
			phases[1] = 18
		elseif (NewAudio.GetPlayTime("One") > 19.57 or everything) and phases[1] == 18 then
			if NewAudio.GetPlayTime("One") <= 20.41 and not everything then
				Arena.ResizeImmediate(220 + 440*math.sin(math.rad(90/0.84*(NewAudio.GetPlayTime("One") - 19.57))), 130)
				AuxX = 320 + 220*math.sin(math.rad(90/0.84*(NewAudio.GetPlayTime("One") - 19.57)))
			else
				Arena.ResizeImmediate(660, 130)
				AuxX = 540
				phases[1] = 19
			end
		elseif (NewAudio.GetPlayTime("One") > 22.95 or everything) and phases[1] == 19 then
			Audio.PlaySound("ding")
			Plataforma.sprite.Set("Bullets/Platforms/70")
			Plataforma.SetVar("No Move", nil)
			if OnSpecialPlatform then
				OnPlatform = true
				OnSpecialPlatform = nil
			end
			spruait = CreateSprite("Bullets/Platforms/70","Top")
			spruait.MoveToAbs(Plataforma.absx, 136)
			table.insert(Zoom, spruait)
			phases[1] = 20
		elseif (NewAudio.GetPlayTime("One") > 23.75 or everything) and phases[1] == 20 then
			table.insert(GBPaps, {Sprite = CreateSprite("Bullets/GB Papyrus/0","Top"), Animacion = {DatosIniciales = {X = 678, Y = 530, rotation = 90}, DatosFinales = {X = 320, Y = 225, rotation = 0}}, Delay = 10, Duration = 20})
			Audio.PlaySound("gasterintro")
			phases[1] = 21
		elseif (NewAudio.GetPlayTime("One") > 24.55 or everything) and phases[1] == 21 then
			Plataforma.Remove()
			Plataforma = nil
			MiniPlats = {CreateProjectileAbs("Bullets/Platforms/35", 302.5, PlatY, "BelowPlayer"), CreateProjectileAbs("Bullets/Platforms/35", 337.5, PlatY, "BelowPlayer")}
			for i=1,#MiniPlats do
				MiniPlats[i].SetVar("PlatX", 302.5 + 35*(i - 1))
				MiniPlats[i].SetVar("PlatY", PlatY)
				MiniPlats[i].SetVar("Plataforma", "Mini")
				MiniPlats[i].ppcollision = false
			end
			phases[1] = 22
		elseif (NewAudio.GetPlayTime("One") > 25.42 or everything) and phases[1] == 22 then
			Audio.PlaySound("ding")
			for i=1,#MiniPlats do
				MiniPlats[i].sprite.Set("Bullets/Magical Platforms/35")
				MiniPlats[i].SetVar("No Move", true)
				if OnPlatform then
					OnSpecialPlatform = true
					OnPlatform = nil
				end
			end
			spruait = CreateSprite("Bullets/Magical Platforms/Special","Top")
			spruait.MoveToAbs(320, 136)
			table.insert(Zoom, spruait)
			phases[1] = 23
		elseif (NewAudio.GetPlayTime("One") > 25.82 or everything) and phases[1] == 23 then
			Audio.PlaySound("ding")
			for i=1,#MiniPlats do
				MiniPlats[i].sprite.Set("Bullets/Platforms/35")
				MiniPlats[i].SetVar("No Move", nil)
				if OnSpecialPlatform then
					OnPlatform = true
					OnSpecialPlatform = nil
				end
			end
			spruait = CreateSprite("Bullets/Platforms/Special","Top")
			spruait.MoveToAbs(320, 136)
			table.insert(Zoom, spruait)
			phases[1] = 24
		elseif (NewAudio.GetPlayTime("One") > 25.82 or everything) and phases[1] == 24 then
			if not Bones then
				Bones = {CreateProjectileAbs("Bullets/Bones/Tight", 118, 290), CreateProjectileAbs("Bullets/Bones/Tight", 524, 290)}
			end
			if NewAudio.GetPlayTime("One") <= 26.22 and not everything then
				for i=1,#Bones do
					Bones[i].MoveToAbs(Bones[i].absx, 290 - 130/0.4*(NewAudio.GetPlayTime("One") - 25.82))
				end
			else
				for i=1,#Bones do
					Bones[i].MoveToAbs(Bones[i].absx, 160)
				end
				phases[1] = 25
			end
		elseif (NewAudio.GetPlayTime("One") > 26.62 or everything) and phases[1] == 25 then
			Encounter.Call("AttackAnim", 2)
			azul = math.random(2)
			Audio.PlaySound("ding")
			spruait = CreateSprite("Bullets/Bones/Tight","Top")
			spruait.color = {33/255, 197/255, 1}
			spruait.MoveToAbs(Bones[azul].absx, Bones[azul].absy)
			table.insert(ZoomBone, spruait)
			phases[1] = 26
		elseif (NewAudio.GetPlayTime("One") > 27.82 or everything) and phases[1] == 26 then
			if NewAudio.GetPlayTime("One") <= 28.62 and not everything then
				for i=1,#Bones do
					Bones[i].MoveToAbs(Bones[i].absx, 290 - 130*math.cos(math.rad(90/0.8*(NewAudio.GetPlayTime("One") - 27.82))))
				end
			else
				for i=1,#Bones do
					Bones[i].Remove()
				end
				Bones = nil
				phases[1] = 27
			end
		elseif (NewAudio.GetPlayTime("One") > 33.57 or everything) and phases[1] == 27 then
			Warns = {CreateSprite("Bullets/Watch Out","BelowPlayer"), CreateSprite("Bullets/Watch Out","BelowPlayer")}
			for i=1,#Warns do
				Warns[i].MoveTo(118 + 406*(i - 1), 170)
			end
			phases[1] = 28
		elseif (NewAudio.GetPlayTime("One") > 34.57 or everything) and phases[1] == 28 then
			for i=1,#Warns do
				Warns[i].Remove()
			end
			Warns = nil
			table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 118, 230), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Lenght = 25, Rotation = 90, Vel = {X = 0, Y = -8}, Extra = {KR = 10, Damage = 10}, Remove = {D = 90, U = 245, L = 0, R = 640}})
			table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 524, 230), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Lenght = 25, Rotation = 90, Vel = {X = 0, Y = -8}, Extra = {KR = 10, Damage = 10}, Remove = {D = 90, U = 245, L = 0, R = 640}})
			phases[1] = 29
		end
		if (NewAudio.GetPlayTime("One") > 8.2 or everything) and phases[2] == 0 then
			for i=0,6 do
				table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 320, 75 - 56*i), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Vel = {X = 0, Y = 1.5}, Remove = {D = -300, U = 245, L = 320, R = 320}})
			end
			phases[2] = 1
		elseif (NewAudio.GetPlayTime("One") > 18.73 or everything) and phases[2] == 1 and Plataforma then
			if NewAudio.GetPlayTime("One") <= 20.41 and not everything then
				VelX = (320 - 70*math.sin(math.rad(180/1.68*(NewAudio.GetPlayTime("One") - 18.73)))) - Plataforma.absx
			else
				VelX = 320 - Plataforma.absx
				VelScreen = -2
				phases[2] = 2
			end
		elseif phases[2] == 2 then
			VelX = nil
			phases[2] = 3
		elseif (NewAudio.GetPlayTime("One") > 26.62 or everything) and phases[2] == 3 and MiniPlats then
			if NewAudio.GetPlayTime("One") <= 27.42 and not everything then
				MiniPlats[1].SetVar("VelX", (302.5 + 10*math.sin(math.rad(180/0.8*(NewAudio.GetPlayTime("One") - 26.62)))) - MiniPlats[1].absx)
				MiniPlats[2].SetVar("VelX", (337.5 - 10*math.sin(math.rad(180/0.8*(NewAudio.GetPlayTime("One") - 26.62)))) - MiniPlats[2].absx)
			else
				MiniPlats[1].SetVar("VelX", 302.5 - MiniPlats[1].absx)
				MiniPlats[2].SetVar("VelX", 337.5 - MiniPlats[2].absx)
				phases[2] = 4
			end
		elseif (NewAudio.GetPlayTime("One") > 27.42 or everything) and phases[2] == 4 then
			if NewAudio.GetPlayTime("One") <= 29.02 and not everything then
				MiniPlats[1].SetVar("VelX", (210.25 + 92.25*math.cos(math.rad(180/1.6*(NewAudio.GetPlayTime("One") - 27.42)))) - MiniPlats[1].absx)
				MiniPlats[2].SetVar("VelX", (429.75 - 92.25*math.cos(math.rad(180/1.6*(NewAudio.GetPlayTime("One") - 27.42)))) - MiniPlats[2].absx)
			else
				MiniPlats[1].SetVar("VelX", 118 - MiniPlats[1].absx)
				MiniPlats[2].SetVar("VelX", 524 - MiniPlats[2].absx)
				phases[2] = 5
			end
		elseif phases[2] == 5 then
			MiniPlats[1].SetVar("VelX", nil)
			MiniPlats[2].SetVar("VelX", nil)
			phases[2] = 6
		elseif (NewAudio.GetPlayTime("One") > 29.79 or everything) and phases[2] == 6 then
			if azul == 1 then
				table.insert(GBPaps, {Sprite = CreateSprite("Bullets/GB Papyrus/0","Top"), Animacion = {DatosIniciales = {X = -76, Y = 530, rotation = -90}, DatosFinales = {X = 118, Y = 330, rotation = 0}}, Blue = true, Scale = 2, Delay = 157, Duration = 30})
				table.insert(GBPaps, {Sprite = CreateSprite("Bullets/GB Papyrus/0","Top"), Animacion = {DatosIniciales = {X = 716, Y = 530, rotation = 90}, DatosFinales = {X = 524, Y = 330, rotation = 0}}, Scale = 2, Delay = 157, Duration = 30})
			elseif azul == 2 then
				table.insert(GBPaps, {Sprite = CreateSprite("Bullets/GB Papyrus/0","Top"), Animacion = {DatosIniciales = {X = -76, Y = 530, rotation = -90}, DatosFinales = {X = 118, Y = 330, rotation = 0}}, Scale = 2, Delay = 157, Duration = 30})
				table.insert(GBPaps, {Sprite = CreateSprite("Bullets/GB Papyrus/0","Top"), Animacion = {DatosIniciales = {X = 716, Y = 530, rotation = 90}, DatosFinales = {X = 524, Y = 330, rotation = 0}}, Blue = true, Scale = 2, Delay = 157, Duration = 30})
			end
			Audio.PlaySound("gasterintro")
			azul = nil
			phases[2] = 7
		elseif (NewAudio.GetPlayTime("One") > 30.99 or everything) and phases[2] == 7 then
			Limite2 = true
			Limite = -43
			AuxX = 597
			PapsX = 960
			BFX = 727
			BAX = 880
			BIX = 1040
			BMX = 1195
			Arena.ResizeImmediate(1280, 130)
			phases[2] = 8
		elseif (NewAudio.GetPlayTime("One") > 34.57 or everything) and phases[2] == 8 then
			VelScreen = nil
			if NewAudio.GetPlayTime("One") <= 35.09 and not everything then
				Arena.ResizeImmediate(1280 - 726*math.sin(math.rad(90/0.52*(NewAudio.GetPlayTime("One") - 34.57))), 130)
				AuxX = -43 + 363*math.sin(math.rad(90/0.52*(NewAudio.GetPlayTime("One") - 34.57)))
			else
				Arena.ResizeImmediate(554, 130)
				AuxX = 320
				phases[2] = 9
			end
		elseif (NewAudio.GetPlayTime("One") > 36.24 or everything) and phases[2] == 9 then
			if not SpecialBlack and not SpecialBone then
				SpecialBlack = CreateProjectileAbs("Rotatory Arena Pixel", 320 + Arena.width/2, 105,"BelowPlayer")
				SpecialBlack.sprite.Scale(0, 20)
				SpecialBlack.sprite.color = {0,0,0}
				SpecialBlack.SetVar("SpecialBullet", true)
				SpecialBone = CreateProjectileAbs("Bullets/Bones/Tight", 400 + Arena.width/2, 102)
				SpecialBone.sprite.rotation = 90
			end
			if NewAudio.GetPlayTime("One") <= 36.64 then
				SpecialBone.MoveToAbs(400 + Arena.width/2 - 640/0.4*(NewAudio.GetPlayTime("One") - 36.24), 102)
			else
				SpecialBlack.Remove()
				SpecialBlack = nil
				SpecialBone.Remove()
				SpecialBone = nil
				for i=1,#Huesotototes do
					Huesotototes[i].Remove()
				end
				Huesotototes = nil
				phases[2] = 10
			end
		elseif (NewAudio.GetPlayTime("One") > 37.91 or everything) and phases[2] == 10 then
			MiniPlats[1].SetVar("VelX", -6)
			MiniPlats[2].SetVar("VelX", 6)
			phases[2] = 11
		elseif (NewAudio.GetPlayTime("One") > 39.58 or everything) and phases[2] == 11 then
			for i=1,#Blacks do
				Blacks[i].Remove()
			end
			for i=1,#MiniPlats do
				MiniPlats[i].Remove()
			end
			Blacks = nil
			MiniPlats = nil
			if GetAlMightyGlobal("Idioma") == "Russian" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:3]Уф...[w:20]\nФуфф...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			else
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:3]Huff...[w:20]\npuff...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			end
			phases[2] = 12
		elseif (NewAudio.GetPlayTime("One") > 46.34 or everything) and phases[2] == 12 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:3]Sans...[w:20] no me\nrendiré.[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:3]Санс...[w:20] Я не\nсдамся.[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			else
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:3]Sans...[w:20] I won't\ngive up.[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			end
			phases[2] = 13
		elseif (NewAudio.GetPlayTime("One") > 51.5 or everything) and phases[2] == 13 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:2]Incluso si tengo\nque arriesgar mi\nvida...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:2]Даже если мне\nпридётся рискнуть\nсвоей жизнью...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			else
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:2]Even if I have\nto put my life\nat risk...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			end
			phases[2] = 14
		elseif (NewAudio.GetPlayTime("One") > 56.45 or everything) and phases[2] == 14 then
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:2]Haré que el\nhumano pague por\nlo que hizo...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:2]Я заставлю\nчеловека\nзаплатить за\nсодеянное...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			else
				Bubble("[noskip][font:papyrus][voice:mad papyrus][waittall:2]I'll make the\nhuman pay for\nwhat they did...[w:100000] ", "rightwide", 490.5, 395, 40, 90, 1)
			end
			phases[2] = 15
		elseif (NewAudio.GetPlayTime("One") > 62.14 or everything) and phases[2] == 15 then
			FakeGB = CreateSprite("Bullets/GB Papyrus/0","Top")
			FakeGB.MoveTo(678, 530)
			FakeGB.rotation = 90
			Audio.PlaySound("gasterintro")
			Bubble("", "", 0, 0, 0, 0, 1)
			phases[2] = 16
		elseif (NewAudio.GetPlayTime("One") > 62.14 or everything) and phases[2] == 16 then
			if NewAudio.GetPlayTime("One") <= 62.64 and not everything then
				FakeGB.MoveTo(678 - 198*math.sin(math.rad(90/0.5*(NewAudio.GetPlayTime("One") - 62.14))), 530 - 170*math.sin(math.rad(90/0.5*(NewAudio.GetPlayTime("One") - 62.14))))
				FakeGB.rotation = 90 - 90*math.sin(math.rad(90/0.5*(NewAudio.GetPlayTime("One") - 62.14)))
			else
				FakeGB.MoveTo(480, 360)
				FakeGB.rotation = 0
				NewAudio.CreateChannel("BRR")
				NewAudio.PlaySound("BRR", "gastervibration", true, 0.5)
				phases[2] = 17
			end
		elseif (NewAudio.GetPlayTime("One") > 62.64 or everything) and phases[2] == 17 then
			if NewAudio.GetPlayTime("One") <= 66.12 and not everything then
				FakeGB.MoveTo(480 + math.random(-2, 2), 360 + math.random(-2, 2))
			else
				SideL = CreateSprite("Bullets/GB Papyrus/Left","Top")
				SideR = CreateSprite("Bullets/GB Papyrus/Right","Top")
				SideL.MoveTo(FakeGB.x, FakeGB.y)
				SideR.MoveTo(FakeGB.x, FakeGB.y)
				FakeGB.Remove()
				FakeGB = nil
				NewAudio.Stop("BRR")
				NewAudio.DestroyChannel("BRR")
				Audio.PlaySound("throw")
				Encounter["Animation"] = "None"
				LittleShake = 0
				phases[2] = 18
			end
		end
		if NewAudio.isStopped("One") and Encounter["GameMusic"] ~= "Wait 3" then
			timer = timer + 1
			if timer == 1 then
				everything = true
				phases[1] = 29
				phases[2] = 18
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[font:papyrus][voice:mad papyrus]No...", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[font:papyrus][voice:mad papyrus]Я...", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[font:papyrus][voice:mad papyrus]I...", "rightwide", 490.5, 395, 40, 90, 1)
				end
				if GetAlMightyGlobal("SkipMonologuePhase2") then
					if GetAlMightyGlobal("Idioma") == "Russian" then
						Skiper = CreateSprite("Specials/Skip-ru", "Top")
						Skiper.MoveTo(201, 466)
					else
						Skiper = CreateSprite("Specials/Skip", "Top")
						Skiper.MoveTo(112, 466)
					end
					Skiper.alpha = 0
				end
			elseif timer == 2 then
				if Bubbles[1] and not Bubbles[1].Activo then
					LittleShake = 0
				else
					timer = 1
				end
			elseif timer == 62 then
				Audio.PlaySound("sparkleslow")
				Encounter.Call("SetHead", "Useless")
				Encounter["Brillo"] = CreateSprite("Papyrus/Brillo","Top")
				Encounter["Brillo"].MoveTo(314, 426)
				Encounter["Brillo"].SetVar("color", 255)
				Encounter["FallBones"] = true
				if Encounter["Spaghetti"] then
					Encounter["SpaghettiDies"] = 0
					local positionsS = {X = Encounter["Spaghetti"].absx, Y = Encounter["Spaghetti"].absy}
					Encounter["Spaghetti"].Remove()
					Encounter["Spaghetti"] = CreateSprite("Papyrus/Spaghetti","Top")
					Encounter["Spaghetti"].MoveTo(positionsS.X, positionsS.Y)
					Encounter["Spaghetti"].SetVar("Position", positionsS)
				end
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus]No puedo hacerlo.[w:60] [next]", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus]Я не могу это\nсделать.[w:60] [next]", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus]I can't do it.[w:60] [next]", "rightwide", 490.5, 395, 40, 90, 1)
				end
			elseif timer == 63 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("RelayerUI", "BelowBullet")
					Enblackeser = CreateSprite("Rotatory Arena Pixel","Top")
					Enblackeser.Scale(640, 236)
					Enblackeser.MoveTo(320, 118)
					Enblackeser.color = {0,0,0}
					Enblackeser.alpha = 0
					Encounter.Call("SetHead", "Well...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]Así que eso es\nlo que es...", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Так вот оно\nкак...", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]So that's what\nit is...", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 62
				end
			elseif timer == 64 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Stare")
					Encounter["HandL"].Set("Papyrus/Arms/Right Tired Inv")
					Encounter["HandL"].SetPivot(8/30, 111/118)
					Encounter["HandL"].rotation = 0
					Encounter["HandL"].MoveTo(286, Encounter["Body"].absy + 11)
					Encounter["Detail"].Remove()
					Encounter["Detail"] = nil
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]La primera cosa\nen la que he\nsido derrotado.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Первое, чего я\nне смог сделать...", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]The first thing\nI've gotten\ndefeated at.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 63
				end
			elseif timer == 65 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "I see")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]Es en matar.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Убийство.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]Is killing.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 64
				end
			elseif timer == 66 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Sans...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]No me extraña el\npor qué sans\ndijo que sería\nestúpido.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Не удивительно[w:10],\nпочему санс\nсказал[w:5], что это\nглупость.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]No wonder why\nsans said it\nwould be stupid.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 65
				end
			elseif timer == 67 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Snif")
				else
					timer = 66
				end
			elseif timer == 186 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Stare")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]Oh sans...[w:20]\nSiempre has sido\ntan inteligente.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Ох[w:5], Санс...[w:20]\nТы всегда был\nтаким умным.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]Oh sans...[w:20]\nYou've always\nbeen so smart.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 185
				end
			elseif timer == 187 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Nyehehe...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]Pedazo de flojo...[w:20]\n[func:SetHead,NYEH!]Desearía que\nestuvieras aquí.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Эх ты[w:5], мешок с\nкостями... [w:20]\nХотел[func:SetHead,NYEH!] бы[w:5], чтобы\nты был рядом.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]You lazybones...[w:20]\n[func:SetHead,NYEH!]I wish you were\nhere.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 186
				end
			elseif timer == 188 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Well2...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]No soy idiota.[w:20]\n[func:SetHead,I see2]Sé que eso no\nes posible.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Я не идиот.[w:20]\n[func:SetHead,I see2]Я знаю, что это\nневозможно.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]I'm not an idiot.[w:20]\n[func:SetHead,I see2]I know that isn't\npossible.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 187
				end
			elseif timer == 189 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Stare2")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus]No es que\nimporte.[w:20] Es muy\ntarde ahora[w:10], no?", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus]Будто бы это\nимело значение.[w:20]\nУже слишком поз-\nдно[w:10], не так ли?", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus]It's not like it\nmatters.[w:20] It's too\nlate now[w:10], isn't it?", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 188
				end
			elseif timer == 190 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Sans2...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus][waittall:2.5]Ya me he [func:SetHead,Snif2]rendido.[func:SetHead,Cry1] ", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus][waittall:2.5]Я уже[func:SetHead,Snif2] сдался.[func:SetHead,Cry1] ", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus][waittall:2.5]I have already[func:SetHead,Snif2]\ngiven up.[func:SetHead,Cry1] ", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 189
				end
			elseif timer == 191 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Crytimer = 0
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:papyrus][waittall:4]Lo siento sans.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:papyrus][waittall:4]Прости меня[w:5],\nсанс.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:papyrus][waittall:4]I'm sorry sans.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 190
				end
			elseif timer == 192 and ((Bubbles[1] and Bubbles[1].Activo) or (Crytimer and Crytimer <= 281)) then
				timer = 191
			elseif timer == 313 then
				Encounter.Call("ContinueMusic")
				Encounter.Call("SetHead", "Cry10")
				if GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[font:papyrus][voice:determined papyrus][waittall:10]Нет.", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[font:papyrus][voice:determined papyrus][waittall:10]No.", "rightwide", 490.5, 395, 40, 90, 1)
				end
			elseif timer == 314 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Cleaning")
					Encounter["HandR"].Set("Papyrus/Arms/Crying Right Hand")
					Encounter["HandR"].SetPivot(1, 0)
					Encounter["HandR"].layer = "Bottom"
					Encounter["HandR"].layer = "Top"
					Encounter["HandR"].MoveTo(Encounter["HandR"].x + 14, Encounter["HandR"].y + 1)
					AnimateHand = 0
				else
					timer = 313
				end
			elseif timer == 453 then
				AnimateHand = nil
				Encounter.Call("SetHead", "Determined")
				Encounter["HandR"].Set("Papyrus/Arms/Right Tired")
				Encounter["HandR"].SetPivot(22/30, 111/118)
				Encounter["HandR"].MoveTo(364, Encounter["Body"].absy + 5)
				Encounter["Legs"].layer = "Bottom"
				Encounter["Legs"].layer = "Top"
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[font:papyrus][voice:determined papyrus]Undyne una vez\nme dijo que los\nhumanos son\ndeterminados.", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[font:papyrus][voice:determined papyrus]Андайн как-то\nсказала мне,\nчто люди полны\nрешимости.", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[font:papyrus][voice:determined papyrus]Undyne once told\nme that humans\nare determined.", "rightwide", 490.5, 395, 40, 90, 1)
				end
			elseif timer == 454 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Cute")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]QUE LINDO!", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]КАК МИЛО!", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]HOW CUTE!", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 453
				end
			elseif timer == 455 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "However")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]Sin embargo...", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]Тем не менее...", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]However...", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 454
				end
			elseif timer == 456 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Great")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]Yo[w:10], el gran\nPapyrus no\nnecesito de eso.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]Я[w:10], великий\nПапирус, в этом\nне нуждаюсь.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]I[w:10], the great\nPapyrus do not\nrequire that.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 455
				end
			elseif timer == 457 then
				if Bubbles[1] and not Bubbles[1].Activo then
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]De hecho...[w:20] Soy\ntan genial que\nno necesito de\nnada.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]На самом деле...[w:20]\nЯ так Велик,\nчто я ни в чём\nне нуждаюсь.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]In fact...[w:20] I am\nso great that\nI don't need\nanything.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 456
				end
			elseif timer == 458 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "NYEH HEH HEH!")
					if GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]НЬЕХ-ХЕХ-ХЕХ!", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]NYEH HEH HEH!", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 457
				end
			elseif timer == 459 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Nyehehe...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]Creí que me\nhabía perdido en\nése entonces.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]Я думал, что\nтогда я потерял\nсебя.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]I thought I had\nlost myself back\nthen.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 458
				end
			elseif timer == 460 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Determined")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]PERO NO.", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]НО НЕТ.", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]BUT NO.", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 459
				end
			elseif timer == 461 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "Great")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]Yo soy[w:10], y siempre\nseré...", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]Я был[w:10], и всегда\nбуду...", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]I am[w:10], and always\nwill be...", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 460
				end
			elseif timer == 462 then
				if Bubbles[1] and not Bubbles[1].Activo then
					Encounter.Call("SetHead", "NYEH HEH HEH!")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[font:papyrus][voice:determined papyrus]El gran papyrus!", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[font:papyrus][voice:determined papyrus]Великим\nПапирусом!", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[font:papyrus][voice:determined papyrus]The great\npapyrus!", "rightwide", 490.5, 395, 40, 90, 1)
					end
				else
					timer = 461
				end
			elseif timer == 463 then
				if Bubbles[1] and not Bubbles[1].Activo then
					if Enblackeser then
						Enblackeser.Remove()
						Enblackeser = nil
					end
					for i=1,#GBPaps do
						GBPaps[i - tableaux].Sprite.Remove()
						table.remove(GBPaps, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,#Zoom do
						Zoom[i - tableaux].Remove()
						table.remove(Zoom, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,#ZoomBone do
						ZoomBone[i - tableaux].Remove()
						table.remove(ZoomBone, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					if Blacks then
						for i=1,#Blacks do
							Blacks[i].Remove()
						end
						Blacks = nil
					end
					if Warns then
						Warns[1].Remove()
						Warns[2].Remove()
						Warns = nil
					end
					if FakeGB then
						FakeGB.Remove()
						FakeGB = nil
					end
					if SideL then
						SideL.Remove()
						SideL = nil
					end
					if SideR then
						SideR.Remove()
						SideR = nil
					end
					if Skiper then
						Skiper.Remove()
						Skiper = nil
					end
					SetAlMightyGlobal("SkipMonologuePhase2", true)
					Encounter["Volumen"] = 1
					Encounter.Call("RelayerUI", "BelowArena")
					Encounter["nextwaves"] = {"Intro Phase 3"}
					Encounter["GameMusic"] = "Fade"
					State("ACTIONSELECT")
					State("DEFENDING")
				else
					timer = 462
				end
			end
			if Input.GetKey("N") > 0 and GetAlMightyGlobal("SkipMonologuePhase2") and not Encounter["Spaghetti"] then
				Bubble("", "", 0, 0, 0, 0, 1)
				timer = 462
			end
		end
		if Skiper and not Encounter["Spaghetti"] then
			Skiper.alpha = Skiper.alpha + 0.02
		end
		if AnimateHand then
			AnimateHand = AnimateHand + 1
			if AnimateHand%40 == 20 then
				Encounter["HandR"].MoveTo(Encounter["HandR"].x, Encounter["HandR"].y - 2)
			elseif AnimateHand%40 == 0 then
				Encounter["HandR"].MoveTo(Encounter["HandR"].x, Encounter["HandR"].y + 2)
			end
		end
		if Crytimer then
			Crytimer = Crytimer + 1
			if Crytimer == 1 then
				Encounter.Call("SetHead", "Cry2")
			elseif Crytimer == 41 then
				Encounter.Call("SetHead", "Cry3")
			elseif Crytimer == 81 then
				Encounter.Call("SetHead", "Cry4")
			elseif Crytimer == 121 then
				Encounter.Call("SetHead", "Cry5")
			elseif Crytimer == 161 then
				Encounter.Call("SetHead", "Cry6")
			elseif Crytimer == 201 then
				Encounter.Call("SetHead", "Cry7")
			elseif Crytimer == 241 then
				Encounter.Call("SetHead", "Cry8")
			elseif Crytimer == 281 then
				Encounter.Call("SetHead", "Cry9")
			end
		end
		if Enblackeser then
			Enblackeser.alpha = Enblackeser.alpha + 0.01
		end
		if LittleShake then
			LittleShake = LittleShake + 1
			if LittleShake <= 10 then
				PapsX = 320 - 2*math.sin(math.rad(36*LittleShake))
			end
		end
		if SideL and SideR then
			SideL.MoveTo(SideL.x - 0.5, SideL.y + 1)
			SideR.MoveTo(SideR.x + 0.5, SideR.y - 1)
			SideL.alpha = SideL.alpha - 0.05
			SideR.alpha = SideR.alpha - 0.05
			if SideL.alpha <= 0 then
				SideL.Remove()
				SideR.Remove()
				SideL = nil
				SideR = nil
			end
		end
		if SpecialBlack then
			SpecialBlack.sprite.xscale = -math.max(math.min(SpecialBone.absx - (320 + Arena.width/2), 0), -Arena.width)
			SpecialBlack.MoveToAbs(320 + Arena.width/2 - SpecialBlack.sprite.xscale/2, 105)
		end
		if Warns then
			for i=1,#Warns do
				Warns[i].alpha = 0.2 + 0.1*math.sin(math.rad(1080*NewAudio.GetPlayTime("One")))
			end
		end
		if ForceContinue and phases[1] > 0 then
			Encounter.Call("ContinueMusic")
			if Encounter["GameMusic"] ~= "Wait 3" then
				ForceContinue = nil
			end
		end
		if VelScreen and Limite2 then
			if PapsX <= 320 then
				VelScreen = nil
			end
		end
		if VelScreen then
			if Limite2 then
				PapsX = math.max(PapsX + VelScreen*4, 320)
				BFX = math.max(BFX + VelScreen*4, 87)
				BAX = math.max(BAX + VelScreen*4, 240)
				BIX = math.max(BIX + VelScreen*4, 400)
				BMX = math.max(BMX + VelScreen*4, 555)
			else
				PapsX = PapsX + VelScreen*4
				BFX = BFX + VelScreen*4
				BAX = BAX + VelScreen*4
				BIX = BIX + VelScreen*4
				BMX = BMX + VelScreen*4
			end
			AuxX = math.max(AuxX + VelScreen*4, Limite)
			PosX = PosX + VelScreen*4
			while PosX <= -100 do
				PosX = PosX + 14
			end
		end
		Arena.MoveTo(AuxX, 90, false, true)
		Encounter.Call("PapsMoveTo", {PapsX, 240})
		Encounter.Call("ButtonMoveTo", {"Fight", BFX, 27})
		Encounter.Call("ButtonMoveTo", {"Act", BAX, 27})
		Encounter.Call("ButtonMoveTo", {"Item", BIX, 27})
		Encounter.Call("ButtonMoveTo", {"Mercy", BMX, 27})
		if Plataforma then
			PlatX = PlatX + (VelX or 0)
			PlatY = PlatY + (VelY or 0)
			Plataforma.MoveToAbs(PlatX, PlatY)
		end
		if MiniPlats then
			for i=1,#MiniPlats do
				MiniPlats[i].SetVar("PlatX", MiniPlats[i].GetVar("PlatX") + (MiniPlats[i].GetVar("VelX") or 0))
				MiniPlats[i].SetVar("PlatY", MiniPlats[i].GetVar("PlatY") + (MiniPlats[i].GetVar("VelY") or 0))
				MiniPlats[i].MoveToAbs(MiniPlats[i].GetVar("PlatX"), MiniPlats[i].GetVar("PlatY"))
			end
		end
		for i=1,#GBPaps do
			local gb = GBPaps[i - tableaux]
			if not gb.X then
				gb.X = gb.Sprite.x
			end
			if not gb.Y then
				gb.Y = gb.Sprite.y
			end
			gb.Sprite.xscale = (gb.Scale or 1)
			if gb.Animacion then
				if not gb.Animacion.timer then
					gb.Animacion.timer = 0
				end
				gb.Animacion.timer = gb.Animacion.timer + 1
				gb.X = gb.Animacion.DatosIniciales.X + (gb.Animacion.DatosFinales.X - gb.Animacion.DatosIniciales.X)*math.sin(math.rad(gb.Animacion.timer*(90/(gb.Animacion.VelAppearing or 30))))
				gb.Y = gb.Animacion.DatosIniciales.Y + (gb.Animacion.DatosFinales.Y - gb.Animacion.DatosIniciales.Y)*math.sin(math.rad(gb.Animacion.timer*(90/(gb.Animacion.VelAppearing or 30))))
				gb.Sprite.MoveTo(gb.X, gb.Y)
				while gb.Animacion.DatosIniciales.rotation >= 360 or gb.Animacion.DatosIniciales.rotation < 0 do
					if gb.Animacion.DatosIniciales.rotation < 0 then
						gb.Animacion.DatosIniciales.rotation = gb.Animacion.DatosIniciales.rotation + 360
					else
						gb.Animacion.DatosIniciales.rotation = gb.Animacion.DatosIniciales.rotation - 360
					end
				end
				while gb.Animacion.DatosFinales.rotation >= 360 or gb.Animacion.DatosFinales.rotation < 0 do
					if gb.Animacion.DatosFinales.rotation < 0 then
						gb.Animacion.DatosFinales.rotation = gb.Animacion.DatosFinales.rotation + 360
					else
						gb.Animacion.DatosFinales.rotation = gb.Animacion.DatosFinales.rotation - 360
					end
				end
				if gb.Animacion.DatosFinales.rotation - gb.Animacion.DatosIniciales.rotation <= 180 and gb.Animacion.DatosFinales.rotation - gb.Animacion.DatosIniciales.rotation >= -180 then
					gb.Sprite.rotation = gb.Animacion.DatosIniciales.rotation - (gb.Animacion.DatosIniciales.rotation - gb.Animacion.DatosFinales.rotation)*math.sin(math.rad(gb.Animacion.timer*(90/(gb.Animacion.VelAppearing or 30))))
				else
					if gb.Animacion.DatosIniciales.rotation > gb.Animacion.DatosFinales.rotation then
						gb.Sprite.rotation = gb.Animacion.DatosIniciales.rotation + (360 - (gb.Animacion.DatosFinales.rotation - 180 + gb.Animacion.DatosIniciales.rotation - 180)*math.sin(math.rad(gb.Animacion.timer*(90/(gb.Animacion.VelAppearing or 30)))))
					else
						gb.Sprite.rotation = gb.Animacion.DatosIniciales.rotation - (360 - (gb.Animacion.DatosFinales.rotation - 180 + gb.Animacion.DatosIniciales.rotation - 180)*math.sin(math.rad(gb.Animacion.timer*(90/(gb.Animacion.VelAppearing or 30)))))
					end
				end
				if gb.Animacion.timer >= (gb.Animacion.VelAppearing or 30) then
					gb.Animacion = nil
					gb.Done = true
				end
			else
				if gb.Rotation and not gb.Done then
					gb.Sprite.rotation = gb.Rotation
				end
				gb.Delay = gb.Delay - 1
			end
			if gb.Vel then
				gb.X = gb.X - gb.Vel*math.sin(math.rad(gb.Sprite.rotation))
				gb.Y = gb.Y + gb.Vel*math.cos(math.rad(gb.Sprite.rotation))
				gb.Vel = gb.Vel*1.1
				if gb.X < -100 or gb.X > 740 or gb.Y < -100 or gb.Y > 580 then
					gb.Vel = 0
				end
			end
			gb.Sprite.MoveTo(gb.X, gb.Y)
			if gb.Delay < 0 then
				if gb.Delay == -1 then
					gb.Sprite.Set("Bullets/GB Papyrus/1")
					gb.Vel = 2
					Audio.PlaySound("gasterfire")
				elseif gb.Delay <= -2 then
					if gb.Delay == -3 then
						Misc.ShakeScreen(gb.Duration, 8, true)
					end
					if gb.Duration > 0 then
						gb.Duration = gb.Duration - 1
						if not gb.Laser then
							gb.Laser = {Misil = CreateProjectileAbs("Bullets/GB Laser", gb.X + (640 + 26*gb.Sprite.yscale)*math.sin(math.rad(gb.Sprite.rotation)), gb.Y - (640 + 26*gb.Sprite.yscale)*math.cos(math.rad(gb.Sprite.rotation)), "Top")}
							gb.Laser.Misil.sprite.xscale = 0
							gb.Laser.Misil.sprite.rotation = gb.Sprite.rotation
							if gb.Blue then
								gb.Sprite.color = {33/255, 197/255, 1}
								gb.Laser.Misil.sprite.color = {33/255, 197/255, 1}
								gb.Laser.Misil.SetVar("tipo", "Blue")
							end
							gb.Laser.Scale = 0
							if gb.NoDamage then
								gb.Laser.Misil.SetVar("No Damage", true)
							end
						else
							gb.Laser.Misil.MoveToAbs(gb.X + (640 + 26*gb.Sprite.yscale)*math.sin(math.rad(gb.Sprite.rotation)), gb.Y - (640 + 26*gb.Sprite.yscale)*math.cos(math.rad(gb.Sprite.rotation)))
							if gb.Laser.Misil.sprite.xscale < 0.9*gb.Sprite.xscale and gb.Laser.Scale == 0 then
								gb.Laser.Misil.sprite.xscale = gb.Laser.Misil.sprite.xscale + 0.1*gb.Sprite.xscale
							else
								gb.Laser.Scale = gb.Laser.Scale + 50
								gb.Laser.Misil.sprite.xscale = 0.9*gb.Sprite.xscale + 0.1*gb.Sprite.xscale*math.sin(math.rad(gb.Laser.Scale))
								if gb.Bones then
									Blacks = {CreateSprite("Rotatory Arena Pixel", "Top"), CreateSprite("Rotatory Arena Pixel", "Top"), CreateSprite("Rotatory Arena Pixel", "Top"), CreateSprite("Rotatory Arena Pixel", "Top")}
									Blacks[1].Scale(300, 140)
									Blacks[2].Scale(300, 140)
									Blacks[3].Scale(640, 300)
									Blacks[4].Scale(640, 300)
									Blacks[1].color = {0,0,0}
									Blacks[2].color = {0,0,0}
									Blacks[3].color = {0,0,0}
									Blacks[4].color = {0,0,0}
									for i=1,#Huesotototes do
										Huesotototes[i].sprite.alpha = 1
										Huesotototes[i].SetVar("No Damage", nil)
									end
									gb.Sprite.layer = "Bottom"
									gb.Laser.Misil.sprite.layer = "Bottom"
									Encounter.Call("RelayerUI", "Top")
									for i=1,#Encounter["LegsParts"] do
										Encounter["LegsParts"][i].layer = "Top"
									end
									Encounter["BoneR"].layer = "Top"
									Encounter["HandL"].layer = "Top"
									Encounter["HandR"].layer = "Top"
									Encounter["Legs"].layer = "Top"
									gb.Sprite.layer = "Top"
									gb.Laser.Misil.sprite.layer = "Top"
									gb.Bones = nil
								end
							end
						end
					else
						gb.Laser.Misil.SetVar("No Damage", true)
						if gb.Laser.Misil.sprite.xscale > 0 then
							gb.Laser.Misil.MoveToAbs(gb.X + (640 + 26*gb.Sprite.yscale)*math.sin(math.rad(gb.Sprite.rotation)), gb.Y - (640 + 26*gb.Sprite.yscale)*math.cos(math.rad(gb.Sprite.rotation)))
							gb.Laser.Misil.sprite.xscale = gb.Laser.Misil.sprite.xscale - 0.05*gb.Sprite.xscale
							gb.Laser.Misil.sprite.alpha = gb.Laser.Misil.sprite.xscale
						else
							gb.Laser.Misil.Remove()
							gb.Sprite.Remove()
							gb = nil
							table.remove(GBPaps, i - tableaux)
							tableaux = tableaux + 1
						end
					end
				end
			end
		end
		tableaux = 0
		for i=1,#Bones1 do
			local Datos = Bones1[i - tableaux]
			if not Datos.X then
				Datos.X = Datos.Body.absx
			end
			if not Datos.Y then
				Datos.Y = Datos.Body.absy
			end
			if not Datos.Rotation then
				Datos.Rotation = 0
			end
			if not Datos.Lenght then
				Datos.Lenght = 20
			end
			if Datos.Extra then
				if Datos.Extra.KR then
					Datos.Body.SetVar("ExtraKR", Datos.Extra.KR)
					Datos.Legs.SetVar("ExtraKR", Datos.Extra.KR)
					Datos.Head.SetVar("ExtraKR", Datos.Extra.KR)
				end
				if Datos.Extra.Damage then
					Datos.Body.SetVar("ExtraDamage", Datos.Extra.Damage)
					Datos.Legs.SetVar("ExtraDamage", Datos.Extra.Damage)
					Datos.Head.SetVar("ExtraDamage", Datos.Extra.Damage)
				end
			end
			Datos.Body.sprite.yscale = Datos.Lenght
			Datos.Body.sprite.rotation = Datos.Rotation
			Datos.Head.sprite.rotation = Datos.Rotation
			Datos.Legs.sprite.rotation = Datos.Rotation + 180
			Datos.X = Datos.X + Datos.Vel.X
			Datos.Y = Datos.Y + Datos.Vel.Y
			Datos.Body.MoveToAbs(Datos.X, Datos.Y)
			Datos.Head.MoveToAbs(Datos.X - (Datos.Body.sprite.yscale/2 + 2.5)*math.sin(math.rad(Datos.Rotation)), Datos.Y + (Datos.Body.sprite.yscale/2 + 2.5)*math.cos(math.rad(Datos.Rotation)))
			Datos.Legs.MoveToAbs(Datos.X + (Datos.Body.sprite.yscale/2 + 2.5)*math.sin(math.rad(Datos.Rotation)), Datos.Y - (Datos.Body.sprite.yscale/2 + 2.5)*math.cos(math.rad(Datos.Rotation)))
			if Datos.Y > Datos.Remove.U or Datos.Y < Datos.Remove.D or Datos.X > Datos.Remove.R or Datos.X < Datos.Remove.L then
				Datos.Body.Remove()
				Datos.Head.Remove()
				Datos.Legs.Remove()
				table.remove(Bones1, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		for i=1,#Zoom do
			Zoom[i - tableaux].Scale(Zoom[i - tableaux].xscale + 0.05, Zoom[i - tableaux].yscale + 0.05)
			Zoom[i - tableaux].alpha = Zoom[i - tableaux].alpha - 0.05
			Zoom[i - tableaux].MoveTo(Zoom[i - tableaux].x, 134 + 2*Zoom[i - tableaux].yscale)
			if Zoom[i - tableaux].alpha <= 0 then
				Zoom[i - tableaux].Remove()
				table.remove(Zoom, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		for i=1,#ZoomBone do
			ZoomBone[i - tableaux].Scale(ZoomBone[i - tableaux].xscale + 0.05, ZoomBone[i - tableaux].yscale + 0.05)
			ZoomBone[i - tableaux].alpha = ZoomBone[i - tableaux].alpha - 0.05
			if ZoomBone[i - tableaux].alpha <= 0 then
				ZoomBone[i - tableaux].Remove()
				table.remove(ZoomBone, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		if Huesotototes then
			Huesotototes[1].MoveToAbs(PosX, 105)
		end
		if Blacks and not NotMove then
			Blacks[1].MoveTo(AuxX - Arena.width/2 - 155, 160)
			Blacks[2].MoveTo(AuxX + Arena.width/2 + 155, 160)
			Blacks[3].MoveTo(AuxX, -60)
			Blacks[4].MoveTo(AuxX, 380)
		end
		if state == 1 then -- Down
			if Input.Right > 0 then
				newpX = newpX + 3
			end
			if Input.Left > 0 then
				newpX = newpX - 3
			end
			if not OnPlatform and VelScreen then
				newpX = newpX + VelScreen
			end
			if newpY > 85 + Arena.height and jump > 0 then
				newpY = 87 + Arena.height
				jump = 0
			elseif OnSpecialPlatform then
				if Input.Up > 0 then
					jump = maxjump
				end
				OnSpecialPlatform = nil
			elseif OnPlatform then
				if Input.Up > 0 then
					jump = maxjump
				else
					newpX = newpX + (VelX or 0)
					newpY = newpY + (VelY or 0)
				end
				OnPlatform = nil
			elseif newpY < 105 then
				if Input.Up > 0 then
					jump = maxjump
				else
					newpY = 103
					jump = 0
				end
			elseif jump < 3 and jump > -3 then
				jump = jump - 0.5
			elseif jump < -3 and jump > -10 then
				jump = -10
			elseif jump < -3 then
				jump = jump - 1.5
			else
				jump = (jump/1.001) - 1
			end
			if Input.Up < 0 and jump > 3 then
				jump = 2
			end
			newpY = math.max(newpY + (jump/10), 103)
			if newpX < AuxX - Arena.width/2 + 8 then
				newpX = AuxX - Arena.width/2 + 8
			elseif newpX > AuxX + Arena.width/2 - 8 then
				newpX = AuxX + Arena.width/2 - 8
			end
			Player.MoveToAbs(newpX, newpY, true)
		end
	end
end

function OnHit(bullet)
	if SpecialBlack then
		if Player.absx > SpecialBlack.absx - SpecialBlack.sprite.xscale/2 - 4 and Player.absx < SpecialBlack.absx + SpecialBlack.sprite.xscale/2 + 4 and Player.absy < SpecialBlack.absy + SpecialBlack.sprite.yscale/2 + 4 then
			PlayerNeverDamage = true
		else
			PlayerNeverDamage = nil
		end
	else
		PlayerNeverDamage = nil
	end
	if not bullet.GetVar("No Damage") and not bullet.GetVar("Plataforma") and not Player.isHurting and not PlayerNeverDamage then
		if bullet.GetVar("tipo") then
			if bullet.GetVar("tipo") == "Blue" and (jump ~= 0 or Input.Left > 0 or Input.Right > 0) then
				if Player.hp > (bullet.GetVar("ExtraDamage") or 1) then
					Player.hp = Player.hp - (bullet.GetVar("ExtraDamage") or 1)
					Encounter.Call("AddKR", (bullet.GetVar("ExtraKR") or 1))
				else
					CauseDeath()
				end
				Player.Hurt(0, 2/60)
				Encounter["NOHIT"] = nil
			elseif bullet.GetVar("tipo") == "Orange" and (jump == 0 and Input.Left == 0 and Input.Right == 0) then
				if Player.hp > (bullet.GetVar("ExtraDamage") or 1) then
					Player.hp = Player.hp - (bullet.GetVar("ExtraDamage") or 1)
					Encounter.Call("AddKR", (bullet.GetVar("ExtraKR") or 1))
				else
					CauseDeath()
				end
				Player.Hurt(0, 2/60)
				Encounter["NOHIT"] = nil
			end
		else
			if Player.hp > (bullet.GetVar("ExtraDamage") or 1) then
				Player.hp = Player.hp - (bullet.GetVar("ExtraDamage") or 1)
				Encounter.Call("AddKR", (bullet.GetVar("ExtraKR") or 1))
			else
				CauseDeath()
			end
			Player.Hurt(0, 2/60)
			Encounter["NOHIT"] = nil
		end
	elseif bullet.GetVar("Plataforma") and jump <= 0 then
		if newpY >= PlatY + 4 and newpY <= PlatY + 12 then
			newpY = PlatY + 8
			jump = 0
			if bullet.GetVar("Plataforma") == "Mini" then
				VelX = (bullet.GetVar("VelX") or 0)
				VelY = (bullet.GetVar("VelY") or 0)
			end
			if bullet.GetVar("No Move") then
				OnSpecialPlatform = true
			else
				OnPlatform = true
			end
			impulsado = nil
		end
	end
end

function CauseDeath()
	for i=1,#GBPaps do
		GBPaps[i - tableaux].Sprite.Remove()
		table.remove(GBPaps, i - tableaux)
		tableaux = tableaux + 1
	end
	tableaux = 0
	for i=1,#Zoom do
		Zoom[i - tableaux].Remove()
		table.remove(Zoom, i - tableaux)
		tableaux = tableaux + 1
	end
	tableaux = 0
	for i=1,#ZoomBone do
		ZoomBone[i - tableaux].Remove()
		table.remove(ZoomBone, i - tableaux)
		tableaux = tableaux + 1
	end
	tableaux = 0
	if Blacks then
		for i=1,#Blacks do
			Blacks[i].Remove()
		end
		Blacks = nil
	end
	if Warns then
		Warns[1].Remove()
		Warns[2].Remove()
		Warns = nil
	end
	if FakeGB then
		FakeGB.Remove()
		FakeGB = nil
	end
	if SideL then
		SideL.Remove()
		SideL = nil
	end
	if SideR then
		SideR.Remove()
		SideR = nil
	end
	Bubble("", "", "", "", "", "", 1)
	Encounter["X"] = Player.absx
	Encounter["Y"] = Player.absy
	Encounter.Call("RelayerUI", "BelowArena")
	Encounter["nextwaves"] = {"Game Over"}
	State("ACTIONSELECT")
	State("DEFENDING")
end 