require "Dialogs"

Arena.Resize(250, 130)
Player.SetControlOverride(true)

state = 1
maxjump = 52
jump = 0
newpX = 320
newpY = 103
phases = {0,0}
tableaux = 0
timer = 0

Black = CreateSprite("Pixel","Top")
Black.Scale(640, 480)
Black.MoveTo(320, 240)
Black.color = {0,0,0}
Bone10 = CreateProjectileAbs("Bullets/Bones/Super/135", -30, 0)
for i=135, 238 do
	Bone10.sprite.Set("Bullets/Bones/Super/"..i)
end
Bone10.Remove()
Bone10 = nil

Bones1 = {}
Bones2 = {}
Bones3 = {}
Generator = {}
Smoke = {}
Effect = {}
Pelotas = {}

SetPPCollision(true)

function RecolorSoul()
	if state >= 1 and state <= 3 then
		Player.sprite.color = {0,60/255,1}
		Player.sprite.rotation = 0
	else
		Player.sprite.color = {1.0,0.0,0.0}
		Player.sprite.rotation = 0
	end
end

RecolorSoul()

function Update()
	DialogUpdate()
	SongTime = NewAudio.GetPlayTime("One")
	if timer < 60 then
		timer = timer + 1
	elseif timer == 60 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Lo siento.", "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]I'm sorry.", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 61
	elseif timer == 61 and Bubbles[1] and not Bubbles[1].Activo then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]No debí haber\nfingido las\nexpectativas de\nmi hermano.", "rightwide", 490.5, 395, 40, 90, 1)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Bubble("[font:papyrus][voice:papyrus]Мне не стоило\nобманывать\nожидания моего\nбрата.", "rightwide", 490.5, 395, 40, 90, 1)
		else
			Bubble("[font:papyrus][voice:papyrus]I shouldn't\nhave faked\nmy brother's\nexpectations.", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 62
	elseif timer == 62 and Bubbles[1] and not Bubbles[1].Activo then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Me asustas.", "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]You scare me.", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 63
	elseif timer == 63 and Bubbles[1] and not Bubbles[1].Activo then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Eso es lo que\ncausó todo esto.", "rightwide", 490.5, 395, 40, 90, 1)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Bubble("[font:papyrus][voice:papyrus]Вот из-за чего\nвсё это произо-\nшло.", "rightwide", 490.5, 395, 40, 90, 1)
		else
			Bubble("[font:papyrus][voice:papyrus]That's what\ncaused all of\nthis.", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 64
	elseif timer == 64 and Bubbles[1] and not Bubbles[1].Activo then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Nunca entendí\nla matanza.", "rightwide", 490.5, 395, 40, 90, 1)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Bubble("[font:papyrus][voice:papyrus]Я никогда не\nпонимал смысл\nв убийстве.", "rightwide", 490.5, 395, 40, 90, 1)
		else
			Bubble("[font:papyrus][voice:papyrus]I never\nunderstood the\nkilling.", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 65
	elseif timer == 65 and Bubbles[1] and not Bubbles[1].Activo then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Y cuando traté\nde aprender[func:PapyrusGhost][waittall:5]. . . .", "rightwide", 490.5, 395, 40, 90, 1)
		elseif GetAlMightyGlobal("Idioma") == "Russian" then
			Bubble("[font:papyrus][voice:papyrus]А когда я\nпопытался\nпонять[func:PapyrusGhost][waittall:5]. . . .", "rightwide", 490.5, 395, 40, 90, 1)
		else
			Bubble("[font:papyrus][voice:papyrus]And when I tried\nto learn[func:PapyrusGhost][waittall:5]. . . .", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 66
	elseif timer >= 66 and timer < 186 and Bubbles[1] and not Bubbles[1].Activo then
		timer = timer + 1
	elseif timer == 186 then
		Black.alpha = Black.alpha - 0.02
		if Black.alpha <= 0 then
			Black.Remove()
			Black = nil
			timer = 187
		end
	elseif timer >= 187 and timer < 247 then
		timer = timer + 1
	elseif timer == 247 then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Solo empeoró.", "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]It only got\nworse.", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 248
	elseif timer == 248 and Bubbles[1] and not Bubbles[1].Activo then
		if GetAlMightyGlobal("Idioma") == "Spanish" then
			Bubble("[font:papyrus][voice:papyrus]Y es por eso\nque...", "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]And that's why...", "rightwide", 490.5, 395, 40, 90, 1)
		end
		timer = 249
	elseif timer >= 249 then
		timer = timer + 1
		if phases[1] == 0 and Bubbles[1] and not Bubbles[1].Activo then
			Encounter.Call("SetHead", "NO!")
			if GetAlMightyGlobal("Idioma") == "Spanish" then
				Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Aún creo en ti.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
			elseif GetAlMightyGlobal("Idioma") == "Russian" then
				Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Я всё ещё верю\nв тебя.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
			else
				Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]I still believe in\nyou.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
			end
			Encounter["GameMusic"] = "Finale"
			phases[1] = 1
		elseif phases[1] == 1 then
			if SongTime > 3.2 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Incluso si no ves\nel punto.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Даже если ты не\nвидишь в этом\nсмысла.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Even if you don't\nsee the point.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 2
			end
		elseif phases[1] == 2 then
			if SongTime > 5.7 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]No veo el punto\nen matar gente.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Я же не вижу\nсмысла в\nубийстве людей.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]I don't see the\npoint in killing\npeople.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 3
			end
		elseif phases[1] == 3 then
			if SongTime > 8.8 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Talvez no nos\nentendemos el\nuno al otro.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Может быть,\nмы просто не\nпонимаем друг\nдруга.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Maybe we just\ndon't understand\neach other.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 4
			end
		elseif phases[1] == 4 then
			if SongTime > 12.3 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Pero es hora de\nque me entienda\na mí.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Но пришло\nвремя мне\nпонять себя.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]But it's time I\nunderstand\nmyself.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 5
			end
		elseif phases[1] == 5 then
			if SongTime > 15 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Todavía estas\nahí[w:5], en alguna\nparte.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Ты всё ещё\nтам[w:5], где-то.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]You're still in\nthere[w:5], somewhere.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 6
			end
		elseif phases[1] == 6 then
			if SongTime > 18.6 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Incluso si no lo\ncrees.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Даже если ты\nтак не думаешь.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Even if you don't\nthink so.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 7
			end
		elseif phases[1] == 7 then
			if SongTime > 21.2 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Aún puedes hacer\nlo correcto.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Ты всё ещё\nможешь посту-\nпить правильно.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]You can still do\nthe right thing.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 8
			end
		elseif phases[1] == 8 then
			if SongTime > 23.7 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Hora de hacer\nesto a mi manera.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Пришло время[w:5],\nсделать это\nпо-моему.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Time to do this\nmy way.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 9
			end
		elseif phases[1] == 9 then
			if SongTime > 25.5 then
				Bubble("", "", 0, 0, 0, 0, 1)
				Encounter.Call("InitiatePhase4", 2)
				phases[1] = 10
			end
		elseif phases[1] == 10 then
			if SongTime > 25.5 then
				if not White then
					White = CreateSprite("Pixel","Top")
					White.Scale(640, 480)
					White.MoveTo(320, 240)
				end
				if SongTime <= 26.57 then
					Encounter.Call("PapsMoveTo", {322 + 4/1.07*(SongTime - 25.5)*math.sin(math.rad(360/0.15*(SongTime - 25.5))), 289})
					White.alpha = 1/1.07*(SongTime - 25.5)
				else
					Encounter.Call("PapsMoveTo", {322, 289})
					White.color = {0,0,0}
					White.alpha = 1
					phases[1] = 11
				end
			end
		elseif phases[1] == 11 then
			if SongTime > 27.43 then
				White.Remove()
				White = nil
				BigBone1 = CreateProjectileAbs("Bullets/Bones/Masive", 150, 355, "BelowArena")
				BigBone2 = CreateProjectileAbs("Bullets/Bones/Masive", 490, 355, "BelowArena")
				BigBone1.SetVar("No Damage", true)
				BigBone2.SetVar("No Damage", true)
				Encounter.Call("InitiatePhase4", 3)
				state = 2
				table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 447, 116), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = 32, Vel = -4})
				table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 193, 116), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = 32, Vel = 4})
				phases[1] = 12
			end
		elseif phases[1] == 12 then
			if SongTime > 28.05 then
				table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 447, 148), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = 96, Vel = -4, Minimum = true})
				phases[1] = 13
			end
		elseif phases[1] == 13 then
			if SongTime > 28.5 then
				if not Warning then
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 390, 225), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = 0, Vel = 0, Maximum = true})
					Warning = {CreateSprite("Pixel", "BelowBullet"), CreateSprite("Pixel", "BelowBullet"), CreateSprite("Pixel", "BelowBullet")}
					Warning[1].color = {0.5, 0, 0}
					Warning[2].color = {0.5, 0, 0}
					Warning[3].color = {0.5, 0, 0}
					Warning[1].Scale(2, 50)
					Warning[2].Scale(2, 50)
					Warning[3].Scale(47, 2)
					Warning[1].MoveTo(320 + Arena.width/2 - 1, 120)
					Warning[2].MoveTo(320 + Arena.width/2 - 48, 120)
					Warning[3].MoveTo(320 + Arena.width/2 - 24.5, 144)
				end
				if SongTime <= 28.72 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Minimum then
							Datos.Scale = 96 - 90/0.22*(SongTime - 28.5)
							Datos.Y = 148 - 45/0.22*(SongTime - 28.5)
						elseif Datos.Maximum then
							Datos.Scale = 91/0.22*(SongTime - 28.5)
							Datos.Y = 225 - 50.5/0.22*(SongTime - 28.5)
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Minimum then
							Datos.Scale = 6
							Datos.Y = 103
						elseif Datos.Maximum then
							Datos.Scale = 91
							Datos.Y = 174.5
						end
					end
					phases[1] = 14
				end
			end
		elseif phases[1] == 14 then
			if SongTime > 28.72 then
				if SongTime <= 29.15 then
					Arena.ResizeImmediate(250 - 100*math.sin(math.rad(180/0.43*(SongTime - 28.72))), 130)
					Arena.MoveTo(320 + 50*math.sin(math.rad(180/0.43*(SongTime - 28.72))), 90, false, true)
					Limitar = 203 + 217*math.sin(math.rad(90/0.43*(SongTime - 28.72)))
				else
					Arena.ResizeImmediate(250, 130)
					Arena.MoveTo(320, 90, false, true)
					Limitar = 420
					Warning[1].Remove()
					Warning[2].Remove()
					Warning[3].Remove()
					Warning = nil
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 420.5, 93), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = 39, Vel = 0, Rotation = 90, Bueso = true})
					phases[1] = 15
				end
			end
		elseif phases[1] == 15 then
			if SongTime > 29.15 then
				if SongTime <= 29.5 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso then
							Datos.Y = 93 + 50*math.sin(math.rad(90/0.35*(SongTime - 29.15)))
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso then
							Datos.Y = 143
						end
					end
					Warning2 = CreateSprite("Bullets/Watch Out","BelowPlayer")
					Warning2.MoveTo(418.5, 116)
					phases[1] = 16
				end
			end
		elseif phases[1] == 16 then
			if SongTime > 29.5 then
				if SongTime <= 29.85 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso then
							Datos.Y = 93 + 50*math.cos(math.rad(90/0.35*(SongTime - 29.5)))
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i - tableaux]
						if Datos.Bueso then
							Datos.Body.Remove()
							Datos.Head.Remove()
							Datos.Legs.Remove()
							table.remove(Bones1, i - tableaux)
							tableaux = tableaux + 1
						end
					end
					tableaux = 0
					Warning3 = CreateSprite("Bullets/Watch Out","BelowPlayer")
					Warning3.MoveTo(435, 214.5)
					Warning4 = CreateSprite("Bullets/Watch Out","BelowPlayer")
					Warning4.MoveTo(419, 214.5)
					Warning5 = CreateSprite("Bullets/Watch Out","BelowPlayer")
					Warning5.MoveTo(403, 214.5)
					phases[1] = 17
				end
			end
		elseif phases[1] == 17 then
			if SongTime > 30 then
				if SongTime <= 30.3 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Maximum then
							Datos.X = 447 - 57*math.cos(math.rad(90/0.3*(SongTime - 30)))
							Datos.Y = 117.5 + 57*math.cos(math.rad(90/0.3*(SongTime - 30)))
							Datos.Scale = 45.5 + math.min(Datos.Y - 95, 45.5)
							if Datos.Scale < 91 then
								Datos.Y = 95 + Datos.Scale/2
							end
						end
					end
					if SongTime > 30.15 and Warning2 then
						Warning2.Remove()
						Warning2 = nil
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i - tableaux]
						if Datos.Maximum then
							Datos.Body.Remove()
							Datos.Head.Remove()
							Datos.Legs.Remove()
							table.remove(Bones1, i - tableaux)
							tableaux = tableaux + 1
						end
					end
					tableaux = 0
					if Warning2 then
						Warning2.Remove()
						Warning2 = nil
					end
					phases[1] = 18
				end
			end
		elseif phases[1] == 18 then
			if SongTime > 30.43 then
				if SongTime <= 30.73 then
					Arena.ResizeImmediate(250, 130 - 109*math.sin(math.rad(90/0.3*(SongTime - 30.43))))
					Arena.MoveTo(320, 90 + 109*math.sin(math.rad(90/0.3*(SongTime - 30.43))), false, true)
				else
					Arena.ResizeImmediate(250, 21)
					Arena.MoveTo(320, 199, false, true)
					Warning6 = CreateSprite("Bullets/Watch Out","BelowPlayer")
					Warning6.MoveTo(205, 214.5)
					phases[1] = 19
				end
			end
		elseif phases[1] == 19 then
			if not bone then
				table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 435, 201.5), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = -5, Vel = 0, Bueso1 = true})
				bone = true
			end
			if SongTime > 30.86 then
				if SongTime <= 30.97 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso1 then
							Datos.Scale = -5 + 21/0.11*(SongTime - 30.86)
							Datos.Y = 204 + Datos.Scale/2
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso1 then
							Datos.Scale = 16
							Datos.Y = 204 + Datos.Scale/2
						end
					end
					Warning3.Remove()
					Warning3 = nil
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 419, 201.5), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = -5, Vel = 0, Bueso2 = true})
					phases[1] = 20
				end
			end
		elseif phases[1] == 20 then
			if SongTime > 30.97 then
				if SongTime <= 31.08 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso2 then
							Datos.Scale = -5 + 21/0.11*(SongTime - 30.97)
							Datos.Y = 204 + Datos.Scale/2
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso2 then
							Datos.Scale = 16
							Datos.Y = 204 + Datos.Scale/2
						end
					end
					Warning4.Remove()
					Warning4 = nil
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 403, 201.5), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = -5, Vel = 0, Bueso3 = true})
					phases[1] = 21
				end
			end
		elseif phases[1] == 21 then
			if SongTime > 31.08 then
				if SongTime <= 31.19 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso3 then
							Datos.Scale = -5 + 21/0.11*(SongTime - 31.08)
							Datos.Y = 204 + Datos.Scale/2
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso3 then
							Datos.Scale = 16
							Datos.Y = 204 + Datos.Scale/2
						end
					end
					Warning5.Remove()
					Warning5 = nil
					CubredorL = CreateSprite("Pixel","Top")
					CubredorL.color = {0,0,0}
					CubredorL.Scale(190, 31)
					CubredorL.MoveTo(95, 214.5)
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 140, 214.5), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = 100, Vel = 0, Rotation = 90, Bueso4 = true})
					phases[1] = 22
				end
			end
		elseif phases[1] == 22 then
			if SongTime > 31.19 then
				if SongTime <= 31.65 then
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso4 then
							Datos.X = 140 + 207/0.46*(SongTime - 31.19)
							if Datos.X > 153 and Warning6 then
								Warning6.Remove()
								Warning6 = nil
							end
							if Datos.X > 250 then
								for j=1,#Bones1 do
									local Datos2 = Bones1[j]
									if Datos2.Bueso1 then
										Datos2.X = 435 + (Datos.X - 250)
									elseif Datos2.Bueso2 then
										Datos2.X = 419 + (Datos.X - 250)
									elseif Datos2.Bueso3 then
										Datos2.X = 403 + (Datos.X - 250)
									end
								end
							end
						end
					end
				else
					for i=1,#Bones1 do
						local Datos = Bones1[i]
						if Datos.Bueso4 then
							Datos.X = 347
						elseif Datos.Bueso3 or Datos.Bueso2 or Datos.Bueso1 then
							Datos.X = 650
						end
					end
					if Warning6 then
						Warning6.Remove()
						Warning6 = nil
					end
					CubredorL.Scale(150, 10)
					CubredorL.MoveTo(347, 235)
					phases[1] = 23
				end
			end
		elseif phases[1] == 23 then
			if SongTime > 31.65 then
				if SongTime <= 31.95 then
					Arena.ResizeImmediate(250 + 259/0.3*(SongTime - 31.65), 21 + 109/0.3*(SongTime - 31.65))
					Arena.MoveTo(320, 199 - 109/0.3*(SongTime - 31.65), false, true)
					for i=1,#Bones1 do
						local Datos = Bones1[i - tableaux]
						if Datos.Bueso4 then
							if SongTime < 31.9 then
								Datos.Y = 214.5 + 15.5/0.25*(SongTime - 31.65)
							else
								Datos.Body.Remove()
								Datos.Head.Remove()
								Datos.Legs.Remove()
								table.remove(Bones1, i - tableaux)
								tableaux = tableaux + 1
							end
						end
					end
					tableaux = 0
				else
					Arena.ResizeImmediate(509, 130)
					Arena.MoveTo(320, 90, false, true)
					for i=1,#Bones1 do
						local Datos = Bones1[i - tableaux]
						if Datos.Bueso4 then
							Datos.Body.Remove()
							Datos.Head.Remove()
							Datos.Legs.Remove()
							table.remove(Bones1, i - tableaux)
							tableaux = tableaux + 1
						end
					end
					tableaux = 0
					CubredorL.Scale(60.5, 140)
					CubredorL.MoveTo(30.25, 160)
					CubredorWL = CreateSprite("Pixel","Top")
					CubredorWL.Scale(5, 140)
					CubredorWL.MoveTo(63, 160)
					CubredorR = CreateSprite("Pixel","Top")
					CubredorR.color = {0,0,0}
					CubredorR.Scale(60.5, 140)
					CubredorR.MoveTo(609.75, 160)
					CubredorWR = CreateSprite("Pixel","Top")
					CubredorWR.Scale(5, 140)
					CubredorWR.MoveTo(577, 160)
					Skate = CreateProjectileAbs("Bullets/Bones/Skate", 39, 120.625)
					Skate.sprite.Scale(1.25, 1.25)
					phases[1] = 24
				end
			end
		elseif phases[1] == 24 then
			if SongTime > 31.95 then
				if SongTime <= 33.42 then
					Skate.MoveToAbs(39 + 562/1.47*(SongTime - 31.95), 120.625)
				else
					Skate.MoveToAbs(601, 120.625)
					if GetAlMightyGlobal("Idioma") == "Russian" then
						Cool = CreateProjectileAbs("Bullets/Bones/Cool-ru", 647, 122)
						Dude = CreateProjectileAbs("Bullets/Bones/Dude-ru", 900.5, 122)
					else
						Cool = CreateProjectileAbs("Bullets/Bones/Cool", 647, 122)
						Dude = CreateProjectileAbs("Bullets/Bones/Dude", 900.5, 122)
					end
					phases[1] = 25
				end
			end
		elseif phases[1] == 25 then
			if SongTime > 33.42 then
				if SongTime <= 36.65 then
					Cool.MoveToAbs(647 - 798.5/3.23*(SongTime - 33.42), 122)
					Dude.MoveToAbs(900.5 - 798.5/3.23*(SongTime - 33.42), 122)
				else
					Cool.MoveToAbs(647 - 798.5/3.23*(SongTime - 33.42), 122)
					Dude.MoveToAbs(900.5 - 798.5/3.23*(SongTime - 33.42), 122)
					Bone1 = CreateProjectileAbs("Bullets/Bones/Bunch", 608, 123.5)
					Bone2 = CreateProjectileAbs("Bullets/Bones/Bunch", 668, 123.5)
					Bone3 = CreateProjectileAbs("Bullets/Bones/Bunch", 728, 123.5)
					Bone4 = CreateProjectileAbs("Bullets/Bones/Bunch", 788, 123.5)
					Bone5 = CreateProjectileAbs("Bullets/Bones/Bunch", 848, 123.5)
					Bone6 = CreateProjectileAbs("Bullets/Bones/Bunch", 908, 123.5)
					Bone7 = CreateProjectileAbs("Bullets/Bones/Bunch", 968, 123.5)
					Bone8 = CreateProjectileAbs("Bullets/Bones/Bunch", 1028, 123.5)
					Bone9 = CreateProjectileAbs("Bullets/Bones/Bunch", 1088, 123.5)
					Bone10 = CreateProjectileAbs("Bullets/Bones/Super/135", 1145, 215)
					phases[1] = 26
				end
			end
		elseif phases[1] == 26 then
			if SongTime > 36.65 then
				if SongTime <= 41.15 then
					Cool.MoveToAbs(647 - 798.5/3.23*(SongTime - 33.42), 122)
					Dude.MoveToAbs(900.5 - 798.5/3.23*(SongTime - 33.42), 122)
					Bone1.MoveToAbs(608 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone2.MoveToAbs(668 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone3.MoveToAbs(728 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone4.MoveToAbs(788 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone5.MoveToAbs(848 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone6.MoveToAbs(908 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone7.MoveToAbs(968 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone8.MoveToAbs(1028 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone9.MoveToAbs(1088 - 1115/4.5*(SongTime - 36.65), 123.5)
					Bone10.MoveToAbs(1145 - 1115/4.5*(SongTime - 36.65), 215)
				else
					Cool.Remove()
					Dude.Remove()
					Bone1.Remove()
					Bone2.Remove()
					Bone3.Remove()
					Bone4.Remove()
					Bone5.Remove()
					Bone6.Remove()
					Bone7.Remove()
					Bone8.Remove()
					Bone9.Remove()
					Bone10.Remove()
					Cool = nil
					Dude = nil
					Bone1 = nil
					Bone2 = nil
					Bone3 = nil
					Bone4 = nil
					Bone5 = nil
					Bone6 = nil
					Bone7 = nil
					Bone8 = nil
					Bone9 = nil
					Bone10 = nil
					high = "No"
					Encounter.Call("SetHead", "Thinking")
					phases[1] = 27
				end
				if Bone1 and Bone1.absx - 33 <= newpX and not high then
					high = "Yes"
				end
			end
		elseif phases[1] == 27 then
			if SongTime > 42.43 then
				if not Carro then
					Encounter.Call("SetHead", "nyeh...")
					Carro = CreateProjectileAbs("Bullets/Carro", 648, 130.875, "BelowBullet")
					Carro.sprite.Scale(1.75, 1.75)
				end
				if SongTime <= 44.64 then
					Carro.MoveToAbs(-8 + 656*math.cos(math.rad(90/2.21*(SongTime - 42.43))), 130.875)
					if timer%4 == 0 then
						table.insert(Smoke, {Sprite = CreateSprite("Bullets/Smoke", "BelowBullet"), X = Carro.absx + 44.625, Y = Carro.absy + 4.375, Direction = 0.5})
					end
				else
					Carro.MoveToAbs(-8, 130.875)
					Carro.sprite.Set("Bullets/Carro Volteado")
					phases[1] = 28
				end
			end
		elseif phases[1] == 28 then
			if SongTime > 45.22 then
				Encounter.Call("SetHead", "Tired")
				table.insert(Pelotas, {Bullet = CreateProjectileAbs("Bullets/Pelota", 640, 530, "Top"), X = 640, Inicio = 45.22})
				table.insert(Pelotas, {Bullet = CreateProjectileAbs("Bullets/Pelota", 940, 530, "Top"), X = 940, Inicio = 45.47})
				table.insert(Pelotas, {Bullet = CreateProjectileAbs("Bullets/Pelota", 1040, 530, "Top"), X = 1040, Inicio = 45.72})
				table.insert(Pelotas, {Bullet = CreateProjectileAbs("Bullets/Pelota", 1140, 530, "Top"), X = 1140, Inicio = 45.97})
				phases[1] = 29
			end
		elseif phases[1] == 29 then
			if SongTime > 49.7 then
				if SongTime <= 51.91 then
					Carro.MoveToAbs(648 - 656*math.cos(math.rad(90/2.21*(SongTime - 49.7))), 130.875)
					if timer%4 == 0 then
						table.insert(Smoke, {Sprite = CreateSprite("Bullets/Smoke", "BelowBullet"), X = Carro.absx - 44.625, Y = Carro.absy + 4.375, Direction = -0.5})
					end
				else
					Carro.Remove()
					Carro = nil
					phases[1] = 30
				end
			end
		elseif phases[1] == 30 then
			if SongTime > 52.3 then
				if SongTime <= 54.85 then
					Skate.MoveToAbs(39 + 562/2.55*(SongTime - 52.3), 120.625)
				else
					Skate.Remove()
					Skate = nil
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "U", Inicio = 54.85, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "U", Inicio = 54.85, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "U", Inicio = 54.85, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "D", Inicio = 54.85, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "D", Inicio = 54.85, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "D", Inicio = 54.85, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "U", Inicio = 55.94, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "U", Inicio = 55.94, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "U", Inicio = 55.94, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "D", Inicio = 55.94, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "D", Inicio = 55.94, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "D", Inicio = 55.94, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "U", Inicio = 57.03, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "U", Inicio = 57.03, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "U", Inicio = 57.03, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "D", Inicio = 57.03, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "D", Inicio = 57.03, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "D", Inicio = 57.03, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "U", Inicio = 58.12, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "U", Inicio = 58.12, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "U", Inicio = 58.12, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2, Direction = "D", Inicio = 58.12, Scale = 40, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 16, Direction = "D", Inicio = 58.12, Scale = 50, VelScale = -0.75, Max = 60, Min = 0})
					table.insert(Bones2, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10), Down = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Arena.x + Arena.width/2 + 32, Direction = "D", Inicio = 58.12, Scale = 60, VelScale = -0.75, Max = 60, Min = 0})
					Bone1 = CreateProjectileAbs("Bullets/Bones/Bunch", 608, 123.5)
					Bone2 = CreateProjectileAbs("Bullets/Bones/Bunch", 668, 123.5)
					Bone3 = CreateProjectileAbs("Bullets/Bones/Bunch", 728, 123.5)
					Bone4 = CreateProjectileAbs("Bullets/Bones/Bunch", 788, 123.5)
					Bone5 = CreateProjectileAbs("Bullets/Bones/Bunch", 848, 123.5)
					Bone6 = CreateProjectileAbs("Bullets/Bones/Bunch", 908, 123.5)
					Bone7 = CreateProjectileAbs("Bullets/Bones/Bunch", 968, 123.5)
					Bone8 = CreateProjectileAbs("Bullets/Bones/Bunch", 1028, 123.5)
					Bone9 = CreateProjectileAbs("Bullets/Bones/Bunch", 1088, 123.5)
					Bone10P = CreateProjectileAbs("Bullets/Bones/Bunch", 1148, 123.5)
					Bone11 = CreateProjectileAbs("Bullets/Bones/Bunch", 1208, 123.5)
					Bone12 = CreateProjectileAbs("Bullets/Bones/Bunch", 1268, 123.5)
					Plat1 = CreateProjectileAbs("Bullets/Magical Platforms/80", 615, 165, "BelowPlayer")
					Plat1.SetVar("Plataforma", true)
					Plat1.ppcollision = false
					Plat2 = CreateProjectileAbs("Bullets/Magical Platforms/80", 860, 165, "BelowPlayer")
					Plat2.SetVar("Plataforma", true)
					Plat2.ppcollision = false
					Plat3 = CreateProjectileAbs("Bullets/Magical Platforms/80", 1110, 165, "BelowPlayer")
					Plat3.SetVar("Plataforma", true)
					Plat3.ppcollision = false
					Plat4 = CreateProjectileAbs("Bullets/Magical Platforms/80", 1360, 165, "BelowPlayer")
					Plat4.SetVar("Plataforma", true)
					Plat4.ppcollision = false
					phases[1] = 31
				end
			end
		elseif phases[1] == 31 then
			if SongTime > 61.89 then
				if SongTime <= 68 then
					Bone1.MoveToAbs(608 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone2.MoveToAbs(668 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone3.MoveToAbs(728 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone4.MoveToAbs(788 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone5.MoveToAbs(848 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone6.MoveToAbs(908 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone7.MoveToAbs(968 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone8.MoveToAbs(1028 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone9.MoveToAbs(1088 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone10P.MoveToAbs(1148 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone11.MoveToAbs(1208 - 1115/4.5*(SongTime - 62.44), 123.5)
					Bone12.MoveToAbs(1268 - 1115/4.5*(SongTime - 62.44), 123.5)
					Plat1.MoveToAbs(615 - 590/2.6*(SongTime - 61.89), 165)
					Plat2.MoveToAbs(860 - 590/2.6*(SongTime - 61.89), 165)
					Plat3.MoveToAbs(1110 - 590/2.6*(SongTime - 61.89), 165)
					Plat4.MoveToAbs(1360 - 590/2.6*(SongTime - 61.89), 165)
				else
					Bone1.Remove()
					Bone2.Remove()
					Bone3.Remove()
					Bone4.Remove()
					Bone5.Remove()
					Bone6.Remove()
					Bone7.Remove()
					Bone8.Remove()
					Bone9.Remove()
					Bone10P.Remove()
					Bone11.Remove()
					Bone12.Remove()
					Plat1.Remove()
					Plat2.Remove()
					Plat3.Remove()
					Plat4.Remove()
					Bone1 = nil
					Bone2 = nil
					Bone3 = nil
					Bone4 = nil
					Bone5 = nil
					Bone6 = nil
					Bone7 = nil
					Bone8 = nil
					Bone9 = nil
					Bone10P = nil
					Bone11 = nil
					Bone12 = nil
					Plat1 = nil
					Plat2 = nil
					Plat3 = nil
					Plat4 = nil
					phases[1] = 32
				end
			end
		elseif phases[1] == 32 then
			if SongTime > 68.59 then
				Encounter.Call("SetHead", "Thinking")
				phases[1] = 33
			end
		elseif phases[1] == 33 then
			if SongTime > 68.79 then
				BigBone1.SetVar("No Damage", nil)
				BigBone2.SetVar("No Damage", nil)
				BigBone1.SetVar("tipo", "Blue")
				BigBone2.SetVar("tipo", "Blue")
				BigBone1.sprite.color = {33/255, 197/255, 1}
				BigBone2.sprite.color = {33/255, 197/255, 1}
				BigBone1.sprite.layer = "Top"
				BigBone2.sprite.layer = "Top"
				table.insert(Effect, {Sprite = CreateSprite("Bullets/Bones/Masive", "Top"), X = 150, Y = 355, Color = {33/255, 197/255, 1}, Rotation = 45})
				table.insert(Effect, {Sprite = CreateSprite("Bullets/Bones/Masive", "Top"), X = 490, Y = 355, Color = {33/255, 197/255, 1}, Rotation = -45})
				phases[1] = 34
			end
		elseif phases[1] == 34 then
			if SongTime > 69.43 then
				if SongTime <= 70.71 then
					BigBone1.MoveToAbs(315 - 165*math.cos(math.rad(180/1.28*(SongTime - 69.43))), 217.5 + 137.5*math.cos(math.rad(180/1.28*(SongTime - 69.43))))
					BigBone2.MoveToAbs(325 + 165*math.cos(math.rad(180/1.28*(SongTime - 69.43))), 217.5 + 137.5*math.cos(math.rad(180/1.28*(SongTime - 69.43))))
					BigBone1.sprite.rotation = 225 - 180*math.cos(math.rad(180/1.28*(SongTime - 69.43)))
					BigBone2.sprite.rotation = -225 + 180*math.cos(math.rad(180/1.28*(SongTime - 69.43)))
				else
					BigBone1.MoveToAbs(480, 80)
					BigBone2.MoveToAbs(160, 80)
					BigBone1.sprite.rotation = 45
					BigBone2.sprite.rotation = -45
					BigBone1.SetVar("tipo", "Orange")
					BigBone2.SetVar("tipo", "Orange")
					BigBone1.sprite.color = {1, 150/255, 0}
					BigBone2.sprite.color = {1, 150/255, 0}
					table.insert(Effect, {Sprite = CreateSprite("Bullets/Bones/Masive", "Top"), X = 480, Y = 80, Color = {1, 150/255, 0}, Rotation = 45})
					table.insert(Effect, {Sprite = CreateSprite("Bullets/Bones/Masive", "Top"), X = 160, Y = 80, Color = {1, 150/255, 0}, Rotation = -45})
					phases[1] = 35
				end
			end
		elseif phases[1] == 35 then
			if SongTime > 70.71 then
				if SongTime <= 72.64 then
					BigBone1.MoveToAbs(480 + 132.5*math.sin(math.rad(180 - 180*math.cos(math.rad(180/3.86*(SongTime - 70.71))))), 212.5 - 132.5*math.cos(math.rad(180 - 180*math.cos(math.rad(180/3.86*(SongTime - 70.71))))))
					BigBone2.MoveToAbs(160 - 132.5*math.sin(math.rad(180 - 180*math.cos(math.rad(180/3.86*(SongTime - 70.71))))), 212.5 - 132.5*math.cos(math.rad(180 - 180*math.cos(math.rad(180/3.86*(SongTime - 70.71))))))
					BigBone1.sprite.rotation = 45 - 720*math.cos(math.rad(180/3.86*(SongTime - 70.71)))
					BigBone2.sprite.rotation = -45 + 720*math.cos(math.rad(180/3.86*(SongTime - 70.71)))
				elseif SongTime <= 74.57 then
					BigBone1.MoveToAbs(480 - 415*math.sin(math.rad(180/3.86*(SongTime - 70.71) - 90)), 345 - 230*math.sin(math.rad(180/3.86*(SongTime - 70.71) - 90)))
					BigBone2.MoveToAbs(160 + 415*math.sin(math.rad(180/3.86*(SongTime - 70.71) - 90)), 345 - 230*math.sin(math.rad(180/3.86*(SongTime - 70.71) - 90)))
					BigBone1.sprite.rotation = 45 - 720*math.cos(math.rad(180/3.86*(SongTime - 70.71)))
					BigBone2.sprite.rotation = -45 + 720*math.cos(math.rad(180/3.86*(SongTime - 70.71)))
				else
					BigBone1.MoveToAbs(65, 115)
					BigBone2.MoveToAbs(575, 115)
					BigBone1.sprite.rotation = 45
					BigBone2.sprite.rotation = -45
					BigBone1.SetVar("tipo", "Blue")
					BigBone2.SetVar("tipo", "Blue")
					BigBone1.sprite.color = {33/255, 197/255, 1}
					BigBone2.sprite.color = {33/255, 197/255, 1}
					table.insert(Effect, {Sprite = CreateSprite("Bullets/Bones/Masive", "Top"), X = 65, Y = 115, Color = {33/255, 197/255, 1}, Rotation = 45})
					table.insert(Effect, {Sprite = CreateSprite("Bullets/Bones/Masive", "Top"), X = 575, Y = 115, Color = {33/255, 197/255, 1}, Rotation = -45})
					phases[1] = 36
				end
			end
		elseif phases[1] == 36 then
			if SongTime > 74.57 then
				if SongTime <= 76.29 then
					BigBone1.MoveToAbs(310 - 245*math.cos(math.rad(180/1.72*(SongTime - 74.57))), 115)
					BigBone2.MoveToAbs(330 + 245*math.cos(math.rad(180/1.72*(SongTime - 74.57))), 115)
					BigBone1.sprite.rotation = 225 + 180*math.cos(math.rad(180/1.72*(SongTime - 74.57)))
					BigBone2.sprite.rotation = -225 - 180*math.cos(math.rad(180/1.72*(SongTime - 74.57)))
				else
					BigBone1.MoveToAbs(555, 115)
					BigBone2.MoveToAbs(85, 115)
					BigBone1.sprite.rotation = 45
					BigBone2.sprite.rotation = -45
					phases[1] = 37
				end
			end
		elseif phases[1] == 37 then
			if SongTime > 76.29 then
				if SongTime <= 77.26 then
					BigBone1.MoveToAbs(555, 137.5 - 22.5*math.cos(math.rad(180/0.97*(SongTime - 76.29))))
					BigBone2.MoveToAbs(85, 137.5 - 22.5*math.cos(math.rad(180/0.97*(SongTime - 76.29))))
					BigBone1.sprite.rotation = 22.5 + 22.5*math.cos(math.rad(180/0.97*(SongTime - 76.29)))
					BigBone2.sprite.rotation = -22.5 - 22.5*math.cos(math.rad(180/0.97*(SongTime - 76.29)))
				else
					BigBone1.MoveToAbs(555, 160)
					BigBone2.MoveToAbs(85, 160)
					BigBone1.sprite.rotation = 0
					BigBone2.sprite.rotation = 0
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Te rindes?[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Ты сдаёшься?[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Do you give up?[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
					end
					phases[1] = 38
				end
			end
		elseif phases[1] == 38 then
			if SongTime > 77.26 then
				if SongTime <= 77.57 then
					BigBone1.MoveToAbs(545 + 10*math.cos(math.rad(180/0.31*(SongTime - 77.26))), 160)
					BigBone2.MoveToAbs(95 - 10*math.cos(math.rad(180/0.31*(SongTime - 77.26))), 160)
				else
					BigBone1.MoveToAbs(535, 160)
					BigBone2.MoveToAbs(105, 160)
					phases[1] = 39
				end
			end
		elseif phases[1] == 39 then
			if SongTime > 79.3 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]No?[w:20]\nSolo un poco\nmás entonces.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Нет?[w:20]\nНу, тогда ещё\nчуть-чуть.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]No?[w:20]\nJust a little\nmore then.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 40
			end
		elseif phases[1] == 40 then
			if SongTime > 81.43 then
				if SongTime <= 82.29 then
					BigBone1.MoveToAbs(535 + 20*math.sin(math.rad(180/0.86*(SongTime - 81.43))), 160)
					BigBone2.MoveToAbs(105 - 20*math.sin(math.rad(180/0.86*(SongTime - 81.43))), 160)
				else
					BigBone1.MoveToAbs(535, 160)
					BigBone2.MoveToAbs(105, 160)
					Encounter.Call("SetHead", "Come on")
					Bubble("", "", 0, 0, 0, 0, 1)
					phases[1] = 41
				end
			end
		elseif phases[1] == 41 then
			if SongTime > 82.29 then
				if SongTime <= 89.36 then
					BigBone1.MoveToAbs(535 - 455/7.07*(SongTime - 82.29), 160)
					BigBone2.MoveToAbs(105 + 455/7.07*(SongTime - 82.29), 160)
				else
					BigBone1.MoveToAbs(80, 160)
					BigBone2.MoveToAbs(560, 160)
					phases[1] = 42
				end
			end
		elseif phases[1] == 42 then
			if SongTime > 89.36 then
				if SongTime <= 95.79 then
					BigBone1.MoveToAbs(80 + 505/6.43*(SongTime - 89.36), 160)
					BigBone2.MoveToAbs(560 - 505/6.43*(SongTime - 89.36), 160)
				else
					BigBone1.MoveToAbs(585, 160)
					BigBone2.MoveToAbs(55, 160)
					Encounter.Call("SetHead", "nyeh...")
					if GetAlMightyGlobal("Idioma") == "Spanish" then
						Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]El punto de\nesto es que te\nrindas.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
					elseif GetAlMightyGlobal("Idioma") == "Russian" then
						Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Смысл всего\nэтого в том[w:5],\nчтобы ты сдался.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
					else
						Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]The whole point\nof this is you\nneed to give up.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
					end
					phases[1] = 43
				end
			end
		elseif phases[1] == 43 then
			if SongTime > 95.79 then
				if SongTime <= 96.01 then
					Arena.ResizeImmediate(509 - 309/0.22*(SongTime - 95.79), 130)
					BigBone1.MoveToAbs(585 + 120/0.22*(SongTime - 95.79), 160)
					BigBone2.MoveToAbs(55 - 120/0.22*(SongTime - 95.79), 160)
					CubredorL.Scale((630 - Arena.width)/2, 140)
					CubredorL.MoveTo(CubredorL.xscale/2, 160)
					CubredorWL.Scale(5, 140)
					CubredorWL.MoveTo(CubredorL.xscale + 2.5, 160)
					CubredorR.Scale((630 - Arena.width)/2, 140)
					CubredorR.MoveTo(640 - CubredorR.xscale/2, 160)
					CubredorWR.Scale(5, 140)
					CubredorWR.MoveTo(640 - (CubredorR.xscale + 2.5), 160)
				else
					Arena.ResizeImmediate(200, 130)
					CubredorL.Scale((630 - Arena.width)/2, 140)
					CubredorL.MoveTo(CubredorL.xscale/2, 160)
					CubredorWL.Scale(5, 140)
					CubredorWL.MoveTo(CubredorL.xscale + 2.5, 160)
					CubredorR.Scale((630 - Arena.width)/2, 140)
					CubredorR.MoveTo(640 - CubredorR.xscale/2, 160)
					CubredorWR.Scale(5, 140)
					CubredorWR.MoveTo(640 - (CubredorR.xscale + 2.5), 160)
					BigBone1.Remove()
					BigBone2.Remove()
					BigBone1 = nil
					BigBone2 = nil
					phases[2] = 22
					phases[1] = 44
				end
			end
		elseif phases[1] == 44 then
			if SongTime > 99.44 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]El momento en\nque dejes de\nresistirte[w:10], yo\ndejaré de\npelear.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]Перестанешь\nсопротивляться[w:10],\nи я перестану\nсражаться.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:0.5]The moment you\nstop resisting[w:10], I'll\nstop fighting.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 45
			end
		elseif phases[1] == 45 then
			if SongTime > 104.58 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:3]Todavía podemos\ntener un buen\nfinal.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:3]Мы ещё можем\nдобиться хорошей\nконцовки.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:papyrus][waittall:3]We can still have\na good ending.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 46
			end
		elseif phases[1] == 46 then
			if SongTime > 109.72 then
				Encounter["Animation"] = "Stop Phase 4"
				Encounter["vel"] = 0
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]No vas a parar,[w:10]\nverdad?[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Ты не думаешь\nостанавливаться,[w:10]\nне так ли?[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:determined papyrus]You're not gonna\nstop,[w:10] are you?[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 47
			end
		elseif phases[1] == 47 then
			if SongTime > 113.15 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Todo lo que\ntienes que hacer\nes [color:f2c900]perdonarme[color:000000].[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Всё, что от\nтебя требуется\nэто [color:f2c900]пощадить[color:000000]\nменя.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:determined papyrus]All you have to\ndo is [color:f2c900]spare[color:000000] me.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 48
			end
		elseif phases[1] == 48 then
			if SongTime > 117.01 then
				Encounter.Call("SetHead", "Please")
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Te dejaré tener\ntu turno ahora.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Я позволяю\nтебе сделать\nтвой ход.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:determined papyrus]I'll let you have\nyour turn now.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 49
			end
		elseif phases[1] == 49 then
			if SongTime > 120.95 then
				if GetAlMightyGlobal("Idioma") == "Spanish" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Por favor[w:10], haz\nlo correcto.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				elseif GetAlMightyGlobal("Idioma") == "Russian" then
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Пожалуйста[w:10],\nпоступи\nправильно.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				else
					Bubble("[noskip][font:papyrus][voice:determined papyrus]Please[w:10], do the\nright thing.[w:100000000] ", "rightwide", 490.5, 395, 40, 90, 1)
				end
				phases[1] = 50
			end
		elseif phases[1] == 50 then
			if SongTime > 124.91 then
				Encounter.Call("SetHead", "...")
				Bubble("", "", 0, 0, 0, 0, 1)
				phases[1] = 51
			end
		end
		if phases[2] == 0 and phases[1] >= 10 then
			if SongTime > 27.43 then
				if not Memory then
					Memory = CreateSprite("Specials/Memory 1","Bottom")
					Memory.SetPivot(51/130, 0.5)
					Memory.Scale(250/76, 250/76)
				end
				if SongTime <= 31.65 then
					Memory.MoveTo(515 - 390/4.22*(SongTime - 27.43), 355)
					Memory.alpha = 0.4*math.sin(math.rad(180/4.22*(SongTime - 27.43)))
				else
					Memory.Set("Specials/Memory 2")
					Memory.SetPivot(117/176, 0.5)
					Memory.Scale(250/72, 250/72)
					Memory.MoveTo(125, 355)
					Memory.alpha = 0
					phases[2] = 1
				end
			end
		elseif phases[2] == 1 then
			if SongTime > 31.65 then
				if SongTime <= 35.87 then
					Memory.MoveTo(515 - 390/4.22*(SongTime - 31.65), 355)
					Memory.alpha = 0.4*math.sin(math.rad(180/4.22*(SongTime - 31.65)))
				else
					Memory.Set("Specials/Memory 3")
					Memory.SetPivot(75/132, 0.5)
					Memory.Scale(250/74, 250/74)
					Memory.MoveTo(125, 355)
					Memory.alpha = 0
					phases[2] = 2
				end
			end
		elseif phases[2] == 2 then
			if SongTime > 35.87 then
				if SongTime <= 39.48 then
					Memory.MoveTo(515 - 390/3.61*(SongTime - 35.87), 355)
					Memory.alpha = 0.4*math.sin(math.rad(180/3.61*(SongTime - 35.87)))
				else
					Memory.Set("Specials/Memory 4")
					Memory.SetPivot(50/132, 0.5)
					Memory.Scale(250/80, 250/80)
					Memory.MoveTo(125, 355)
					Memory.alpha = 0
					phases[2] = 3
				end
			end
		elseif phases[2] == 3 then
			if SongTime > 41.15 then
				if SongTime <= 45.22 then
					Memory.MoveTo(515 - 390/4.07*(SongTime - 41.15), 355)
					Memory.alpha = 0.4*math.sin(math.rad(180/4.07*(SongTime - 41.15)))
				else
					Memory.Remove()
					Memory = nil
					phases[2] = 4
				end
			end
		elseif phases[2] == 4 then
			if SongTime > 82.745 then
				table.insert(Generator, {Rate = 12, X = 72, Vel = 5})
				phases[2] = 5
			end
		elseif BigBone1 and BigBone2 and phases[2] >= 5 and phases[2] <= 21 and phases[2]%2 == 1 then
			if SongTime > 83.6 + 0.855*(phases[2] - 5) then
				BigBone1.SetVar("tipo", "Orange")
				BigBone2.SetVar("tipo", "Orange")
				BigBone1.sprite.color = {1, 150/255, 0}
				BigBone2.sprite.color = {1, 150/255, 0}
				phases[2] = phases[2] + 1
			end
		elseif BigBone1 and BigBone2 and phases[2] >= 5 and phases[2] <= 21 and phases[2]%2 == 0 then
			if SongTime > 84.455 + 0.855*(phases[2] - 6) then
				table.insert(Generator, {Rate = 12, X = 72, Vel = 5})
				BigBone1.SetVar("tipo", "Blue")
				BigBone2.SetVar("tipo", "Blue")
				BigBone1.sprite.color = {33/255, 197/255, 1}
				BigBone2.sprite.color = {33/255, 197/255, 1}
				phases[2] = phases[2] + 1
			end
		elseif phases[2] >= 22 and phases[2] <= 70 then
			if SongTime > 96.01 + 0.25*(phases[2] - 22) then
				local lenght = math.random(30, 100)
				if math.random(2) == 1 then
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 422, 100 + lenght/2), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = lenght, Vel = -math.random(4), Blue = true})
				else
					table.insert(Bones1, {Body = CreateProjectileAbs("Bullets/Bones/Body", 422, 220 - lenght/2), Head = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Legs = CreateProjectileAbs("Bullets/Bones/Head", 0, 0), Scale = lenght, Vel = -math.random(4), Blue = true})
				end
				phases[2] = phases[2] + 1
			end
		end
		if NewAudio.isStopped("One") and Encounter["GameMusic"] == "It's Over" then
			Encounter["Animation"] = "Stop Phase 4"
			Encounter["vel"] = 0
			if White then
				White.Remove()
			end
			if Memory then
				Memory.Remove()
			end
			if Warning then
				Warning[1].Remove()
				Warning[2].Remove()
				Warning[3].Remove()
			end
			if Warning2 then
				Warning2.Remove()
			end
			if Warning3 then
				Warning3.Remove()
			end
			if Warning4 then
				Warning4.Remove()
			end
			if Warning5 then
				Warning5.Remove()
			end
			if Warning6 then
				Warning6.Remove()
			end
			if CubredorL then
				CubredorL.Remove()
			end
			if CubredorR then
				CubredorR.Remove()
			end
			if CubredorWL then
				CubredorWL.Remove()
			end
			if CubredorWR then
				CubredorWR.Remove()
			end
			for i=1,#Smoke do
				Smoke[i - tableaux].Sprite.Remove()
				table.remove(Smoke, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			for i=1,#Effect do
				Effect[i - tableaux].Sprite.Remove()
				table.remove(Effect, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			Encounter.Call("SetHead", "...")
			Bubble("", "", 0, 0, 0, 0, 1)
			Finish = true
		end
	end
	if Warning2 then
		Warning2.alpha = 0.2 + 0.1*math.sin(math.rad(1080*SongTime))
	end
	if Warning3 then
		Warning3.alpha = 0.2 + 0.1*math.sin(math.rad(1080*SongTime))
	end
	if Warning4 then
		Warning4.alpha = 0.2 + 0.1*math.sin(math.rad(1080*SongTime))
	end
	if Warning5 then
		Warning5.alpha = 0.2 + 0.1*math.sin(math.rad(1080*SongTime))
	end
	if Warning6 then
		Warning6.alpha = 0.2 + 0.1*math.sin(math.rad(1080*SongTime))
	end
	if BigBone1 then
		if SongTime <= 68.59 then
			BigBone1.sprite.rotation = 180 + (360*24 + 225)/41.16*(SongTime - 27.43)
		elseif phases[1] < 34 then
			BigBone1.sprite.rotation = 45
		end
	end
	if BigBone2 then
		if SongTime <= 68.59 then
			BigBone2.sprite.rotation = 180 - (360*24 + 225)/41.16*(SongTime - 27.43)
		elseif phases[1] < 34 then
			BigBone2.sprite.rotation = -45
		end
	end
	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
		Datos.X = Datos.X + Datos.Vel
		Datos.Body.sprite.yscale = Datos.Scale
		Datos.Head.sprite.rotation = Datos.Rotation
		Datos.Body.sprite.rotation = Datos.Rotation
		Datos.Legs.sprite.rotation = Datos.Rotation + 180
		if Datos.Blue then
			Datos.Body.SetVar("tipo", "Blue")
			Datos.Head.SetVar("tipo", "Blue")
			Datos.Legs.SetVar("tipo", "Blue")
			Datos.Body.sprite.color = {33/255, 197/255, 1}
			Datos.Head.sprite.color = {33/255, 197/255, 1}
			Datos.Legs.sprite.color = {33/255, 197/255, 1}
		end
		Datos.Body.MoveToAbs(Datos.X, Datos.Y)
		Datos.Head.MoveToAbs(Datos.X - (Datos.Scale/2 + 2.5)*math.sin(math.rad(Datos.Rotation)), Datos.Y + (Datos.Scale/2 + 2.5)*math.cos(math.rad(Datos.Rotation)))
		Datos.Legs.MoveToAbs(Datos.X + (Datos.Scale/2 + 2.5)*math.sin(math.rad(Datos.Rotation)), Datos.Y - (Datos.Scale/2 + 2.5)*math.cos(math.rad(Datos.Rotation)))
		if not Datos.Bueso4 and (Datos.X <= Arena.x - Arena.width/2 - 2 or Datos.X >= Arena.x + Arena.width/2 + 2) 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,#Smoke do
		local Datos = Smoke[i - tableaux]
		if not Datos.Scale then
			Datos.Scale = 0.5
		end
		Datos.X = Datos.X + Datos.Direction
		Datos.Y = Datos.Y + 1
		Datos.Scale = Datos.Scale + 0.06
		Datos.Sprite.MoveTo(Datos.X, Datos.Y)
		Datos.Sprite.Scale(Datos.Scale, Datos.Scale)
		Datos.Sprite.alpha = Datos.Sprite.alpha - 0.035
		if Datos.Sprite.alpha <= 0 then
			Datos.Sprite.Remove()
			table.remove(Smoke, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	for i=1,#Pelotas do
		local Datos = Pelotas[i - tableaux]
		if not Datos.Y then
			Datos.Y = 530
		end
		if SongTime > Datos.Inicio then
			if SongTime <= Datos.Inicio + 1.4 then
				Datos.Y = 145 + 385*math.cos(math.rad(90/1.4*(SongTime - Datos.Inicio)))
			elseif SongTime <= Datos.Inicio + 2.78 then
				Datos.Y = 145 + 165*math.sin(math.rad(180/1.38*(SongTime - (Datos.Inicio + 1.4))))
			elseif SongTime <= Datos.Inicio + 3.64 then
				Datos.Y = 145 + 45*math.sin(math.rad(180/0.86*(SongTime - (Datos.Inicio + 2.78))))
			elseif SongTime <= Datos.Inicio + 3.89 then
				Datos.Y = 145 + 10*math.sin(math.rad(180/0.25*(SongTime - (Datos.Inicio + 3.64))))
			else
				Datos.Y = 145
			end
			Datos.Bullet.sprite.rotation = 135*(SongTime - Datos.Inicio)
			Datos.Bullet.MoveToAbs(Datos.X - 640/3.12*(SongTime - 45.22), Datos.Y)
			if Datos.Bullet.absx <= -50 then
				Datos.Bullet.Remove()
				table.remove(Pelotas, i - tableaux)
				tableaux = tableaux + 1
			end
		end
	end
	tableaux = 0
	for i=1,#Effect do
		local Datos = Effect[i - tableaux]
		if not Datos.Scale then
			Datos.Scale = 1
		end
		Datos.Scale = Datos.Scale + 0.02
		Datos.Sprite.color = Datos.Color
		Datos.Sprite.MoveTo(Datos.X, Datos.Y)
		Datos.Sprite.Scale(Datos.Scale, Datos.Scale)
		Datos.Sprite.rotation = Datos.Rotation
		Datos.Sprite.alpha = Datos.Sprite.alpha - 0.03
		if Datos.Sprite.alpha <= 0 then
			Datos.Sprite.Remove()
			table.remove(Effect, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	for i=1,#Bones2 do
		local Datos = Bones2[i - tableaux]
		if not Datos.Vel then
			Datos.Vel = 0
		end
		if SongTime > Datos.Inicio then
			Datos.PX = Datos.X - 510/3.22*(SongTime - Datos.Inicio)
			Datos.Scale = Datos.Scale + Datos.VelScale
			if Datos.Scale >= Datos.Max or Datos.Scale <= Datos.Min then
				Datos.VelScale = -Datos.VelScale
			end
			if Datos.Direction == "U" then
				Datos.Y = Arena.y + 5 + Arena.height - Datos.Scale/2
			else
				Datos.Y = Arena.y + 5 + Datos.Scale/2
			end
			Datos.Bullet.Body.sprite.yscale = Datos.Scale
			Datos.Bullet.Body.MoveToAbs(Datos.PX, Datos.Y)
			Datos.Bullet.Up.MoveToAbs(Datos.PX, Datos.Y + Datos.Scale/2 + 2.5)
			Datos.Bullet.Down.MoveToAbs(Datos.PX, Datos.Y - Datos.Scale/2 - 2.5)
			Datos.Bullet.Down.sprite.rotation = 180
			if Datos.PX < Arena.x - Arena.width/2 - 2 then
				Datos.Bullet.Body.Remove()
				Datos.Bullet.Up.Remove()
				Datos.Bullet.Down.Remove()
				table.remove(Bones2, i - tableaux)
				tableaux = tableaux + 1
			end
		end
	end
	tableaux = 0
	for i=1,#Generator do
		local Datos = Generator[i - tableaux]
		if not Datos.Timer then
			Datos.Timer = 0
		end
		Datos.Timer = Datos.Timer + 1
		if Datos.Timer >= Datos.Rate then
			table.insert(Bones3, {Bullet = {Body = CreateProjectileAbs("Bullets/Bones/Body", -10, -10), Up = CreateProjectileAbs("Bullets/Bones/Head", -10, -10)}, X = Datos.X, Scale = 40, Vel = Datos.Vel})
			Datos.X = Datos.X + 14
			Datos.Timer = 0
		end
		if Datos.X >= 582 or SongTime > 95.79 then
			table.remove(Generator, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	for i=1,#Bones3 do
		local Datos = Bones3[i - tableaux]
		if not Datos.Angle then
			Datos.Angle = 0
		end
		if SongTime > 95.79 then
			if Datos.Angle >= 90 then
				Datos.Angle = Datos.Angle + 5
			else
				Datos.Angle = Datos.Angle - 5
			end
		else
			Datos.Angle = Datos.Angle + Datos.Vel
		end
		Datos.Y = Arena.y + 5 + Datos.Scale*math.sin(math.rad(Datos.Angle))/2
		Datos.Bullet.Body.sprite.yscale = Datos.Scale*math.sin(math.rad(Datos.Angle))
		Datos.Bullet.Body.MoveToAbs(Datos.X, Datos.Y)
		Datos.Bullet.Up.MoveToAbs(Datos.X, Datos.Y + Datos.Scale*math.sin(math.rad(Datos.Angle))/2 + 2.5)
		if Datos.Angle >= 180 or Datos.Angle <= 0 then
			Datos.Bullet.Body.Remove()
			Datos.Bullet.Up.Remove()
			table.remove(Bones3, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	if state == 1 then -- Down
		if newpY > 85 + Arena.height and jump > 0 then
			newpY = 87 + Arena.height
			jump = 0
		elseif newpY < 105 then
			newpY = 103
			jump = 0
		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 < 328 - Arena.width/2 then
			newpX = 328 - Arena.width/2
		elseif newpX > 312 + Arena.width/2 then
			newpX = 312 + Arena.width/2
		end
		Player.MoveToAbs(newpX, newpY, true)
	elseif state == 2 then -- Down
		if Input.Right > 0 then
			newpX = newpX + 3
		end
		if Input.Left > 0 then
			newpX = newpX - 3
		end
		if newpY > Arena.y - 5 + Arena.height and jump > 0 then
			newpY = Arena.y - 3 + Arena.height
			jump = 0
		elseif newpY < Arena.y + 15 then
			if phases[1] >= 24 then
				state = 3
				maxjump = 28
			end
			if Input.Up > 0 then
				jump = maxjump
			else
				newpY = Arena.y + 13
				jump = 0
			end
		elseif jump < 3 and jump > -3 then
			jump = jump - 1
		elseif jump < -3 and jump > -10 then
			jump = -10
		elseif jump < -3 then
			jump = jump - 3
		else
			jump = (jump/1.001) - 2
		end
		if Input.Up < 0 and jump > 6 then
			jump = 4
		end
		newpY = math.max(newpY + (jump/10), Arena.y + 13)
		if newpX < (Limitar or (Arena.x + 8 - Arena.width/2)) then
			newpX = (Limitar or (Arena.x + 8 - Arena.width/2))
		elseif newpX > Arena.x - 8 + Arena.width/2 then
			newpX = Arena.x - 8 + Arena.width/2
		end
		if Limitar and Limitar >= 420 then
			Limitar = nil
		end
		Player.MoveToAbs(newpX, newpY, true)
	elseif state == 3 then -- Down
		if Input.Right > 0 then
			newpX = newpX + 3
		end
		if Input.Left > 0 then
			newpX = newpX - 3
		end
		if newpY > Arena.y - 5 + Arena.height and jump > 0 then
			newpY = Arena.y - 3 + Arena.height
			jump = 0
		elseif newpY < Arena.y + 15 then
			if Input.Up > 0 then
				jump = maxjump
			else
				newpY = Arena.y + 13
				jump = 0
			end
		elseif OnPlatform then
			if Input.Up > 0 then
				jump = maxjump
			end
			OnPlatform = nil
		elseif jump < 3 and jump > -3 then
			jump = jump - 0.25
		elseif jump < -3 and jump > -10 then
			jump = -10
		elseif jump < -3 then
			jump = jump - 0.75
		else
			jump = (jump/1.001) - 0.5
		end
		if Input.Up > 0 and high and high == "Yes" then
			jump = math.max(jump, 11)
			if newpY >= 338 then
				high = "No"
			end
		elseif Input.Up < 0 and jump > 1.5 then
			if high and high == "Yes" then
				jump = 1
				high = "No"
			end
		end
		newpY = math.max(newpY + (jump/10), Arena.y + 13)
		if newpX < 328 - Arena.width/2 then
			newpX = 328 - Arena.width/2
		elseif newpX > 312 + Arena.width/2 then
			newpX = 312 + Arena.width/2
		end
		Player.MoveToAbs(newpX, newpY, true)
    end
	if high and CubredorL and CubredorWL and CubredorR and CubredorWR then
		Arena.ResizeImmediate(509, math.max(math.min((newpY - 95) + 30, 270), 130))
		if Bone10 then
			if Bone10.absx <= 200 then
				CubredorL.Scale(60.5, math.max(math.min((newpY - 95) + 30, 270), 130) + 10)
				CubredorL.MoveTo(30.25, 90 + CubredorL.yscale/2)
			end
		else
			CubredorL.Scale(60.5, math.max(math.min((newpY - 95) + 30, 270), 130) + 10)
			CubredorL.MoveTo(30.25, 90 + CubredorL.yscale/2)
		end
		CubredorWL.Scale(5, math.max(math.min((newpY - 95) + 30, 270), 130) + 10)
		CubredorWL.MoveTo(63, 90 + CubredorWL.yscale/2)
		CubredorR.Scale(60.5, math.max(math.min((newpY - 95) + 30, 270), 130) + 10)
		CubredorR.MoveTo(609.75, 90 + CubredorR.yscale/2)
		CubredorWR.Scale(5, math.max(math.min((newpY - 95) + 30, 270), 130) + 10)
		CubredorWR.MoveTo(577, 90 + CubredorWR.yscale/2)
		if high == "No" and (newpY - 95) + 30 <= 130 and phases[1] >= 27 then
			high = nil
		end
	end
	if Bone10 then
		Bone10.sprite.Set("Bullets/Bones/Super/"..math.max(math.min(Arena.height + 5, 238), 135))
	end
	if Finish then
		Encounter["timer"] = 0
		EndWave()
	end
end

function OnHit(bullet)
	if not bullet.GetVar("No Damage") and not bullet.GetVar("Plataforma") and not Player.isHurting then
		if bullet.GetVar("tipo") then
			if bullet.GetVar("tipo") == "Blue" and (Input.Left > 0 or Input.Right > 0 or jump ~= 0) then
				if Player.hp > 20 then
					Player.Hurt(20)
				elseif Player.hp > 1 then
					Player.Hurt(Player.hp - 1)
				else
					EndEverything()
				end
				Encounter["NOHIT"] = nil
			elseif bullet.GetVar("tipo") == "Orange" and Input.Left <= 0 and Input.Right <= 0 and jump == 0 then
				if Player.hp > 20 then
					Player.Hurt(20)
				elseif Player.hp > 1 then
					Player.Hurt(Player.hp - 1)
				else
					EndEverything()
				end
				Encounter["NOHIT"] = nil
			end
		else
			if Player.hp > 20 then
				Player.Hurt(20)
			elseif Player.hp > 1 then
				Player.Hurt(Player.hp - 1)
			else
				EndEverything()
			end
			Encounter["NOHIT"] = nil
		end
	elseif bullet.GetVar("Plataforma") and jump <= 0 then
		if newpY >= bullet.absy + 4 and newpY <= bullet.absy + 12 then
			newpY = bullet.absy + 8
			jump = 0
			OnPlatform = true
		end
	end
end

function EndEverything()
	if White then
		White.Remove()
	end
	if Memory then
		Memory.Remove()
	end
	if Warning then
		Warning[1].Remove()
		Warning[2].Remove()
		Warning[3].Remove()
	end
	if Warning2 then
		Warning2.Remove()
	end
	if Warning3 then
		Warning3.Remove()
	end
	if Warning4 then
		Warning4.Remove()
	end
	if Warning5 then
		Warning5.Remove()
	end
	if Warning6 then
		Warning6.Remove()
	end
	if CubredorL then
		CubredorL.Remove()
	end
	if CubredorR then
		CubredorR.Remove()
	end
	if CubredorWL then
		CubredorWL.Remove()
	end
	if CubredorWR then
		CubredorWR.Remove()
	end
	for i=1,#Smoke do
		Smoke[i - tableaux].Sprite.Remove()
		table.remove(Smoke, i - tableaux)
		tableaux = tableaux + 1
	end
	tableaux = 0
	for i=1,#Effect do
		Effect[i - tableaux].Sprite.Remove()
		table.remove(Effect, i - tableaux)
		tableaux = tableaux + 1
	end
	tableaux = 0
	Bubble("", "", 0, 0, 0, 0, 1)
	Encounter["X"] = Player.absx
	Encounter["Y"] = Player.absy
	Encounter["nextwaves"] = {"Game Over"}
	State("ACTIONSELECT")
	State("DEFENDING")
end