BlackD = CreateSprite("Pixel","BelowBullet")
River = CreateSprite("Overworld/Maps/River","BelowBullet")
Bote = CreateSprite("Overworld/Objects/Boat","Top")
Cover = CreateSprite("Overworld/Objects/Boat Cover/1","Top")
RiverPerson = CreateSprite("Overworld/Characters/River Person","Top")
Papaya = CreateSprite("Overworld/Characters/Papyrus/L1","Top")
Black = CreateSprite("Pixel","Top")
Cover.SetAnimation({"Overworld/Objects/Boat Cover/1","Overworld/Objects/Boat Cover/2"}, 0.35)
Papaya.SetPivot(0.5, 0)
RiverPerson.SetPivot(0.5, 0)
Cover.SetPivot(0.5, 0)
RiverPerson.SetParent(Bote)
Black.Scale(640, 480)
Black.color = {0,0,0}
Black.MoveTo(320, 240)
BlackD.Scale(640, 480)
BlackD.color = {0,0,0}
BlackD.MoveTo(320, 240)
River.MoveTo(-80, 240)
Bote.MoveTo(740, 124)
Cover.MoveTo(741, 88)
Papaya.MoveTo(780, 118)
RiverPerson.MoveTo(-21, -8)
PapsY = 120

Cargador = CreateSprite("Overworld/Objects/Cascada/1","BelowBullet")
Cargador.SetAnimation({"Overworld/Objects/Cascada/1","Overworld/Objects/Cascada/2","Overworld/Objects/Cascada/3","Overworld/Objects/Cascada/4"}, 0.15)
Cargador.Remove()
Cargador = nil

timer = 0
tableaux = 0
spawntime = {0, 0, 0, 0}

Waterfall = {}
Cascadas = {}
Plants = {}
Stars = {}
Brillos = {}

function Update()
	timer = timer + 1
	if River then
		River.x = River.x + 2
		if (River.x >= -40 and timer <= 5708) or River.x >= 720 then
			River.x = River.x - 40		
		end
	end
	if timer == 768 then
		Text = CreateSprite("Menu/Disbelief","Top")
		Text.MoveTo(320, 370)
		Text.Scale(0.5, 0.5)
		Text.alpha = 0
	elseif timer > 768 and timer <= 828 then
		Text.alpha = 1/60*(timer - 768)
	elseif timer > 1200 and timer <= 1260 then
		Text.alpha = 1/60*(1260 - timer)
	elseif timer == 1261 then
		Text.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Made")
		Text.MoveTo(320, 400)
		Text.Scale(1, 1)
	elseif timer > 1261 and timer <= 1321 then
		Text.alpha = 1/60*(timer - 1261)
	elseif timer > 1850 and timer <= 1910 then
		Text.alpha = 1/60*(1910 - timer)
	elseif timer == 1911 then
		Text.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Based")
	elseif timer > 1911 and timer <= 1971 then
		Text.alpha = 1/60*(timer - 1911)
	elseif timer > 2500 and timer <= 2560 then
		Text.alpha = 1/60*(2560 - timer)
	elseif timer == 2561 then
		Text.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Papyrus")
		Text.MoveTo(320, 450)
		Text2 = CreateSprite("Credits/"..GetAlMightyGlobal("Idioma").."/Phase 1","Top")
		Text2.MoveTo(320, 300.5)
		Text2.alpha = 0
		Text3 = CreateSprite("Credits/Phase 1","Top")
		Text3.MoveTo(320, 375)
		Text3.alpha = 0
	elseif timer > 3201 and timer <= 3261 then
		Text.alpha = 1/60*(timer - 3201)
		Text2.alpha = 1/60*(timer - 3201)
		Text3.alpha = 1/60*(timer - 3201)
	elseif timer > 3510 and timer <= 3570 then
		Text2.alpha = 1/60*(3570 - timer)
		Text3.alpha = 1/60*(3570 - timer)
	elseif timer == 3571 then
		Text2.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Phase 2")
		Text3.Set("Credits/Phase 2")
	elseif timer > 3571 and timer <= 3631 then
		Text2.alpha = 1/60*(timer - 3571)
		Text3.alpha = 1/60*(timer - 3571)
	elseif timer > 3880 and timer <= 3940 then
		Text2.alpha = 1/60*(3940 - timer)
		Text3.alpha = 1/60*(3940 - timer)
	elseif timer == 3941 then
		Text2.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Phase 3")
		Text3.Set("Credits/Phase 3")
	elseif timer > 3941 and timer <= 4001 then
		Text2.alpha = 1/60*(timer - 3941)
		Text3.alpha = 1/60*(timer - 3941)
	elseif timer > 4250 and timer <= 4310 then
		Text2.alpha = 1/60*(4310 - timer)
		Text3.alpha = 1/60*(4310 - timer)
	elseif timer == 4311 then
		Text2.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Phase 4")
		Text3.Set("Credits/Phase 4")
	elseif timer > 4311 and timer <= 4371 then
		Text2.alpha = 1/60*(timer - 4311)
		Text3.alpha = 1/60*(timer - 4311)
	elseif timer > 4620 and timer <= 4680 then
		Text2.alpha = 1/60*(4680 - timer)
		Text3.alpha = 1/60*(4680 - timer)
	elseif timer == 4681 then
		Text2.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Blaster")
		Text3.Set("Credits/GB")
	elseif timer > 4681 and timer <= 4741 then
		Text2.alpha = 1/60*(timer - 4681)
		Text3.alpha = 1/60*(timer - 4681)
	elseif timer > 4980 and timer <= 5040 then
		Text.alpha = 1/60*(5040 - timer)
		Text2.alpha = 1/60*(5040 - timer)
		Text3.alpha = 1/60*(5040 - timer)
	elseif timer == 5041 then
		Text.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Music")
		Text2.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Themes")
		Text2.MoveTo(320, 360)
		Text.color = {0,0,0}
		Text2.color = {0,0,0}
		Text3.Remove()
		Text3 = nil
	elseif timer > 6000 and timer <= 6060 then
		Text.alpha = 1/60*(timer - 6000)
		Text2.alpha = 1/60*(timer - 6000)
	elseif timer > 7000 and timer <= 7060 then
		Text2.alpha = 1/60*(7060 - timer)
	elseif timer == 7061 then
		Text2.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Song")
		Text2.color = {1,1,1}
	elseif timer > 7061 and timer <= 7121 then
		Text2.alpha = 1/60*(timer - 7061)
	elseif timer > 7420 and timer <= 7480 then
		Text.alpha = 1/60*(7480 - timer)
		Text2.alpha = 1/60*(7480 - timer)
	elseif timer == 7481 then
		Text.Set("Credits/"..GetAlMightyGlobal("Idioma").."/Undertale")
		Text.MoveTo(320, 370.5)
		Text2.Remove()
		Text2 = nil
	elseif timer > 7481 and timer <= 7541 then
		Text.alpha = 1/60*(timer - 7481)
	elseif timer > 7840 and timer <= 7900 then
		Text.alpha = 1/60*(7900 - timer)
	elseif timer == 7901 then
		Text.Remove()
		Text = nil
	end
	if timer <= 3180 and Bote then
		Bote.y = 124 + 2*math.sin(math.rad(180/60*timer))
	end
	if timer <= 3000 and Papaya then
		Papaya.y = 118 + 2*math.sin(math.rad(180/60*timer))
	end
	if timer > 3780 and timer <= 5096 and Bird and Papaya then
		Bird.y = 228 + 2*math.sin(math.rad(180/60*(timer - 3780)))
		Papaya.y = 148 + 2*math.sin(math.rad(180/60*(timer - 3780)))
	end
	if timer <= 120 then
		if timer == 1 then
			NewAudio.PlaySound("One", "Bonetrousle - Megalovania Piano", false, 0)
		end
		Black.alpha = 1/120*(120 - timer)
		NewAudio.SetVolume("One", 1/120*timer)
	elseif timer > 120 and timer <= 420 then
		Papaya.x = 780 - 430/300*(timer - 120)
		Bote.x = 740 - 430/300*(timer - 120)
		Cover.x = 741 - 430/300*(timer - 120)
	elseif timer == 2244 then
		Dog = CreateSprite("Overworld/Characters/Dog/Swiming 1","Top")
		Dog.SetPivot(0.5, 0)
		Dog.SetAnimation({"Overworld/Characters/Dog/Swiming 1","Overworld/Characters/Dog/Swiming 2"}, 0.3)
		Dog.MoveTo(660, 30)
		Bird = CreateSprite("Overworld/Characters/Bird/Idle 1","Top")
		Bird.SetPivot(0.5, 0)
		Bird.SetAnimation({"Overworld/Characters/Bird/Idle 2","Overworld/Characters/Bird/Idle 1"}, 0.3)
		for i=1,#Waterfall do
			local Datos = Waterfall[i]
			Datos.Sprite.SendToTop()
		end
	elseif timer == 2645 then
		Bird.SetAnimation({"Overworld/Characters/Bird/Huh 2","Overworld/Characters/Bird/Huh 1"}, 0.1)
	elseif timer > 2645 and timer <= 2765 then
		Bird.MoveTo(458 - 58/120*(timer - 2645), 48 + 200/120*(timer - 2645))
	elseif timer == 2766 then
		Bird.layer = "BelowBullet"
	elseif timer > 2766 and timer <= 2856 then
		Bird.MoveTo(400 - 50*math.sin(math.rad(90/90*(timer - 2766))), 198 + 50*math.cos(math.rad(90/90*(timer - 2766))))
	elseif timer == 2857 then
		Bird.SetAnimation({"Overworld/Characters/Bird/Flying 2","Overworld/Characters/Bird/Flying 1"}, 0.1)
	elseif timer > 3000 and timer <= 3180 then
		Bird.y = 198 + 40/180*(timer - 3000)
		Papaya.y = 118 + 40/180*(timer - 3000)
	elseif timer > 3180 and timer <= 3780 then
		Bird.MoveTo(350 - 30/600*(timer - 3180), 238 - 10/600*(timer - 3180))
		Papaya.MoveTo(350 - 30/600*(timer - 3180), 158 - 10/600*(timer - 3180))
		River.y = 240 - 240/600*(timer - 3180)
		Bote.y = 124 + 2*math.sin(math.rad(180/60*timer)) - 240/600*(timer - 3180)
		Cover.y = 88 - 240/600*(timer - 3180)
		if Dog then
			Dog.y = 30 - 240/600*(timer - 3180)
		end
		for i=1,#Waterfall do
			local Datos = Waterfall[i]
			Datos.Y = Datos.Y - 240/600
			if Datos.Y <= 210 then
				Datos.Y = Datos.Y + 60
			end
			Datos.Sprite.MoveTo(Datos.X, Datos.Y)
		end
	elseif timer > 5096 and timer <= 5196 then
		local randomizador = math.random(-2, 2)
		Bird.MoveTo(320 + randomizador/100*(timer - 5096), 228 + 2*math.sin(math.rad(180/60*(timer - 3780))) + randomizador/100*(timer - 5096))
		Papaya.MoveTo(320 + randomizador/100*(timer - 5096), 148 + 2*math.sin(math.rad(180/60*(timer - 3780))) + randomizador/100*(timer - 5096))
	elseif timer == 5197 then
		Papaya.SetPivot(0.5, 0.5)
		Bird.MoveTo(320, 228)
		Papaya.MoveTo(320, 190)
		Bird.SetAnimation({"Overworld/Characters/Bird/Huh 2","Overworld/Characters/Bird/Huh 1"}, 0.1)
		Cover.Remove()
		Cover = CreateSprite("Overworld/Characters/Onion San/Cover","BelowBullet")
		Cover.MoveTo(320, 80)
		Cover.Scale(0, 0)
	elseif timer > 5197 and timer <= 5287 then
		Papaya.rotation = 90 - 90*math.cos(math.rad(timer - 5197))
		Papaya.y = 90 + 100*math.cos(math.rad(timer - 5197))
		River.y = 240 - 240*math.cos(math.rad(timer - 5197))
		Bird.y = 480 - 252*math.cos(math.rad(timer - 5197))
	elseif timer == 5288 then
		Papaya.alpha = 0
		Splash = CreateSprite("Overworld/Objects/Splash", "Top")
		Splash.SetPivot(0.5, 0)
		Splash.Scale(2, 0.4)
		Splash.MoveTo(320, 82)
		Splash.alpha = 0
		Splash.SetVar("Timer", 0)
	elseif timer >= 5378 and timer < 5438 then
		Cover.Scale(1.1/60*(timer - 5378), 1.1/60*(timer - 5378))
	elseif timer == 5438 then
		Onion = CreateSprite("Overworld/Characters/Onion San/Happy 1","Top")
		Onion.SetAnimation({"Overworld/Characters/Onion San/Happy 1","Overworld/Characters/Onion San/Happy 2"}, 0.1)
		Onion.MoveTo(320, 18)
		Papaya.MoveTo(319, 41)
		Papaya.layer = "Top"
		Papaya.SendToTop()
		Papaya.rotation = -90
		Papaya.alpha = 1
		FakeWater1 = CreateSprite("Pixel","Top")
		FakeWater1.color = {22/255, 27/255, 81/255}
		FakeWater1.Scale(128, 60)
		FakeWater1.MoveTo(320, 50)
		FakeWater2 = CreateSprite("Pixel","Top")
		FakeWater2.color = {18/255, 10/255, 36/255}
		FakeWater2.Scale(128, 2)
		FakeWater2.MoveTo(320, 19)
		FakeWater3 = CreateSprite("Pixel","Top")
		FakeWater3.color = {0, 0, 0}
		FakeWater3.Scale(128, 18)
		FakeWater3.MoveTo(320, 9)
		Cover1 = CreateSprite("Overworld/Characters/Onion San/Cover","BelowBullet")
		Cover1.MoveTo(320, 80)
		Cover1.Scale(1.1, 1.1)
		Cover2 = CreateSprite("Overworld/Characters/Onion San/Cover 2","Top")
		Cover2.MoveTo(320, 80)
		Cover2.Scale(1.1, 1.1)
		Cover.Remove()
		Cover = nil
		for i=1,#Waterfall do
			local Datos = Waterfall[i]
			Datos.Sprite.SendToTop()
		end
	elseif timer > 5468 and timer <= 5708 then
		Onion.y = 18 + 122/240*(timer - 5468)
		Papaya.y = 41 + 122/240*(timer - 5468)
	elseif timer == 5768 then
		Onion.StopAnimation()
		Onion.Set("Overworld/Characters/Onion San/Normal")
	elseif timer > 7956 and timer <= 8256 then
		Onion.x = 320 - 400/300*(timer - 7956)
		Papaya.x = 319 - 400/300*(timer - 7956)
		Cover1.x = 320 - 400/300*(timer - 7956)
		Cover2.x = 320 - 400/300*(timer - 7956)
	elseif timer > 8226 and timer <= 8346 then
		Black.alpha = 1/120*(timer - 8226)
	elseif timer == 8347 then
		River.Remove()
		Bote.Remove()
		RiverPerson.Remove()
		Cover1.Remove()
		Cover2.Remove()
		Bird.Remove()
		FakeWater1.Remove()
		FakeWater2.Remove()
		FakeWater3.Remove()
		FakeWater1 = nil
		FakeWater2 = nil
		FakeWater3 = nil
		Bird = nil
		Cover1 = nil
		Cover2 = nil
		RiverPerson = nil
		Bote = nil
		River = nil
		for i=1,#Waterfall do
			local Datos = Waterfall[i - tableaux]
			Datos.Sprite.Remove()
			table.remove(Waterfall, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#Cascadas do
			local Datos = Cascadas[i - tableaux]
			for j=1,#Datos.Flowers do
				Datos.Flowers[j].Sprite.Remove()
			end
			Datos.Sprite.Remove()
			table.remove(Cascadas, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#Plants do
			local Datos = Plants[i - tableaux]
			Datos.Sprite.Remove()
			table.remove(Plants, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#Stars do
			local Datos = Stars[i - tableaux]
			Datos.Sprite.Remove()
			table.remove(Stars, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		Castle = CreateSprite("Overworld/Maps/Castle","BelowBullet")
		Castle.MoveTo(320, 240)
		for i=1,70 do
			local spruait = CreateSprite("Overworld/Objects/Brillo/1","BelowBullet")
			local randomizador = {}
			repeat
				done = true
				randomizador = {math.random(10, 630), math.random(280, 470)}
				for j=1,#Brillos do
					if randomizador[1] >= Brillos[j].x - 16 and randomizador[1] <= Brillos[j].x + 16 and randomizador[2] >= Brillos[j].y - 24 and randomizador[2] <= Brillos[j].y + 24 then
						done = nil
					end
				end
			until done
			spruait.MoveTo(randomizador[1], randomizador[2])
			spruait.Scale(0.25 + 1.75/190*(spruait.y - 280), 0.25 + 1.75/190*(spruait.y - 280))
			local randomizador = math.random(12)
			spruait.SetAnimation({"Overworld/Objects/Brillo/"..randomizador%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 1)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 2)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 3)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 4)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 5)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 6)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 7)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 8)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 9)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 10)%12 + 1,"Overworld/Objects/Brillo/"..(randomizador + 11)%12 + 1}, 0.1)
			table.insert(Brillos, spruait)
		end
		Napsta = CreateSprite("Overworld/Characters/Napstablook","BelowBullet")
		Napsta.Scale(0.5, 0.5)
		Papaya.SetPivot(0.5, 0)
		Papaya.Scale(0.5, 0.5)
		Papaya.rotation = 0
		Papaya.SetAnimation({"Overworld/Characters/Papyrus/Normal", "Overworld/Characters/Papyrus/Walking 1", "Overworld/Characters/Papyrus/Normal", "Overworld/Characters/Papyrus/Walking 2"}, 10/60)
		Papaya.MoveTo(700, 90)
		Rocks = CreateSprite("Overworld/Maps/Rocks","Top")
		Rocks.MoveTo(320, 128)
	elseif timer > 8467 and timer <= 8587 then
		Black.alpha = 1/120*(8587 - timer)
	elseif timer > 8587 and timer <= 8947 then
		Papaya.x = 700 - (timer - 8587)
	elseif timer == 8948 then
		Papaya.StopAnimation()
		Papaya.Set("Overworld/Characters/Papyrus/D1")
	elseif timer == 9068 then
		Thanks = CreateSprite("Credits/"..GetAlMightyGlobal("Idioma").."/Thanks","Top")
		Thanks.MoveTo(320, 360)
		Thanks.alpha = 0
	elseif timer > 9068 and timer <= 9118 then
		Thanks.alpha = 1/50*(timer - 9068)
	elseif timer > 9418 and timer <= 9478 then
		Napsta.y = Napsta.y + 0.5
		Napsta.alpha = 1/60*(9478 - timer)
	elseif timer == 9479 then
		Napsta.Remove()
		Napsta = nil
	elseif timer > 9600 and timer <= 9720 then
		Black.alpha = 1/120*(timer - 9600)
		if timer == 9720 and string.sub(GetAlMightyGlobal("Archivimentazo"), 2, 2) == "0" then
			SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 1).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 3))
			Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 2}
		end
	elseif timer == 9960 then
		Thanks.Remove()
		Papaya.Remove()
		Black.Remove()
		BlackD.Remove()
		Rocks.Remove()
		Castle.Remove()
		for i=1,#Brillos do
			Brillos[i].Remove()
		end
		Black = nil
		SetAlMightyGlobal("ShortDialog", false)
		Encounter["nextwaves"] = {"Menu"}
		State("DEFENDING")
	end
	if Napsta and timer <= 9418 then
		Napsta.MoveTo(300, 110 + 2*math.sin(math.rad(180/60*(timer - 8347))))
	end
	if timer >= 5438 and Cover1 and Cover2 then
		Cover1.Scale(1.1 + 0.1*math.sin(math.rad(90/20*(timer - 5438))), 1.1 + 0.1*math.sin(math.rad(90/20*(timer - 5438))))
		Cover2.Scale(1.1 + 0.1*math.sin(math.rad(90/20*(timer - 5438))), 1.1 + 0.1*math.sin(math.rad(90/20*(timer - 5438))))
	end
	if Splash then
		Splash.SetVar("Timer", Splash.GetVar("Timer") + 1)
		Splash.Scale(2 + 1/30*Splash.GetVar("Timer"), 0.4 + 0.8*math.sin(math.rad(180/30*Splash.GetVar("Timer"))))
		Splash.alpha = math.sin(math.rad(180/30*Splash.GetVar("Timer")))
		if Splash.GetVar("Timer") >= 30 then
			Splash.Remove()
			Splash = nil
		end
	end
	if Dog then
		Dog.x = Dog.x - 0.5
		if Dog.x <= -20 then
			Dog.Remove()
			Dog = nil
		end
	end
	if Bird then
		if timer <= 2644 and Dog then
			Bird.MoveTo(Dog.x - 1, 48)
		end
	end
	if timer > 768 and timer < 8347 then
		if spawntime[1] <= 0 then
			table.insert(Waterfall, {Sprite = CreateSprite("Overworld/Objects/Waterfall","Top"), X = -40, Y = 270})
			spawntime[1] = math.random(250, 500)
		else
			spawntime[1] = spawntime[1] - 1
		end
	end
	if timer > 1700 and timer <= 5488 then
		if spawntime[2] <= 0 then
			local spruait = CreateSprite("Overworld/Objects/Cascada/1","BelowBullet")
			spruait.SetAnimation({"Overworld/Objects/Cascada/1","Overworld/Objects/Cascada/2","Overworld/Objects/Cascada/3","Overworld/Objects/Cascada/4"}, 0.15)
			table.insert(Cascadas, {Sprite = spruait, X = River.x - 200})
			spawntime[2] = math.random(700, 1000)
			if Dog then
				Dog.SendToTop()
			end
			if Bird then
				Bird.SendToTop()
			end
			for i=1,#Waterfall do
				local Datos = Waterfall[i]
				Datos.Sprite.SendToTop()
			end
		else
			spawntime[2] = spawntime[2] - 1
		end
	end
	if timer < 8347 then
		if spawntime[3] <= 0 then
			if math.random(2) == 1 then
				if timer <= 5708 then
					local positions = {0, 0, 0}
					for i=1,math.random(3) do
						repeat
							local done = true
							positions[i] = math.random(9)
							for j=1,3 do
								if positions[i] == positions[j] and i ~= j then
									done = false
								end
							end
						until done
						if math.random(3) == 1 then
							local spruait = CreateSprite("Overworld/Objects/Echo Flower/1","BelowBullet")
							spruait.SetPivot(0.5, 0)
							if math.random(2) == 1 then
								spruait.SetAnimation({"Overworld/Objects/Echo Flower/1","Overworld/Objects/Echo Flower/2"}, 0.3)
							else
								spruait.SetAnimation({"Overworld/Objects/Echo Flower/2","Overworld/Objects/Echo Flower/1"}, 0.3)
							end
							table.insert(Plants, {Sprite = spruait, X = -52, Y = 40*positions[i]})
						else
							local spruait = CreateSprite("Overworld/Objects/Grass","BelowBullet")
							spruait.SetPivot(0.5, 0)
							table.insert(Plants, {Sprite = spruait, X = -52, Y = 40*positions[i]})
						end
					end
					for i=1,9 do
						for j=1,#Plants do
							if Plants[j].Y == 400 - 40*i then
								Plants[j].Sprite.SendToTop()
							end
						end
					end
					if Bird then
						Bird.SendToTop()
					end
					for i=1,#Waterfall do
						local Datos = Waterfall[i]
						Datos.Sprite.SendToTop()
					end
				elseif timer >= 5748 then
					local positions = {0, 0, 0}
					for i=1,math.random(3) do
						repeat
							local done = true
							positions[i] = math.random(8)
							for j=1,3 do
								if positions[i] == positions[j] and i ~= j then
									done = false
								end
							end
						until done
						if math.random(6) == 1 then
							local spruait = CreateSprite("Overworld/Objects/Plant 1","BelowBullet")
							if math.random(2) == 1 then
								spruait.Set("Overworld/Objects/Plant 2")
							end
							spruait.SetPivot(0.5, 0)
							table.insert(Plants, {Sprite = spruait, X = -52, Y = -90 + 40*positions[i]})
						else
							local spruait = CreateSprite("Overworld/Objects/Nenufar 1","BelowBullet")
							if math.random(2) == 1 then
								spruait.Set("Overworld/Objects/Nenufar 2")
							end
							spruait.SetPivot(0.5, 0)
							table.insert(Plants, {Sprite = spruait, X = -52, Y = -90 + 40*positions[i]})
						end
					end
					for i=1,8 do
						for j=1,#Plants do
							if Plants[j].Y == 270 - 40*i then
								Plants[j].Sprite.SendToTop()
							end
						end
					end
					if Bird then
						Bird.SendToTop()
					end
					for i=1,#Waterfall do
						local Datos = Waterfall[i]
						Datos.Sprite.SendToTop()
					end
				end
			end
			spawntime[3] = 20
		else
			spawntime[3] = spawntime[3] - 1
		end
		if timer <= 5708 then
			if spawntime[4] <= 0 then
				local spruait = CreateSprite("Overworld/Objects/Star/1","Top")
				spruait.SetAnimation({"Overworld/Objects/Star/1","Overworld/Objects/Star/2","Overworld/Objects/Star/3","Overworld/Objects/Star/2"}, 0.1)
				local initalY = math.random(-200, 200)
				local moveY = math.min(math.max(initalY + math.random(-200, 200), -230), 230) - initalY
				table.insert(Stars, {Sprite = spruait, X = -10, Y = initalY, Move = {X = math.random(-200, 200), Y = moveY, Timer = 0}})
				spawntime[4] = math.random(60, 150)
			else
				spawntime[4] = spawntime[4] - 1
			end
		end
	end
	for i=1,#Waterfall do
		local Datos = Waterfall[i - tableaux]
		Datos.X = Datos.X + 3
		Datos.Y = Datos.Y - 4
		if Datos.Y <= 210 then
			Datos.Y = Datos.Y + 60
		end
		Datos.Sprite.MoveTo(Datos.X, Datos.Y)
		Datos.Sprite.alpha = 0.4
		if Datos.X >= 680 then
			Datos.Sprite.Remove()
			table.remove(Waterfall, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	for i=1,#Cascadas do
		local Datos = Cascadas[i - tableaux]
		if not Datos.Flowers then
			Datos.Flowers = {}
			Datos.Timers = {math.random(600), math.random(600), math.random(600), math.random(600), math.random(600), math.random(600), math.random(600), math.random(600)}
		end
		Datos.X = Datos.X + 2
		Datos.Sprite.MoveTo(Datos.X, River.y + 198)
		if timer > 3600 and timer <= 4900 then
			for j=1,#Datos.Timers do
				Datos.Timers[j] = Datos.Timers[j] - 1
				if Datos.Timers[j] <= 0 then
					local randomizador = math.random(3)
					if randomizador == 1 then
						table.insert(Datos.Flowers, {Sprite = CreateSprite("Overworld/Objects/Aquatic Plant/1","BelowBullet"), X = j, Y = 320})
					elseif randomizador == 2 then
						table.insert(Datos.Flowers, {Sprite = CreateSprite("Overworld/Objects/Aquatic Plant/7","BelowBullet"), X = j, Y = 320})
					else
						table.insert(Datos.Flowers, {Sprite = CreateSprite("Overworld/Objects/Aquatic Plant/1","BelowBullet"), X = j, Y = 320, Bloom = 0})
					end
					Datos.Timers[j] = math.random(150, 600)
					if Bird then
						Bird.SendToTop()
					end
					for i=1,#Waterfall do
						local Datos = Waterfall[i]
						Datos.Sprite.SendToTop()
					end
				end
			end
		end
		local tableaux2 = 0
		for j=1,#Datos.Flowers  do
			local Datos2 = Datos.Flowers[j - tableaux2]
			if Datos2.Bloom then
				Datos2.Bloom = Datos2.Bloom + 1
				if Datos2.Bloom == 60 then
					Datos2.Sprite.Set("Overworld/Objects/Aquatic Plant/2")
				elseif Datos2.Bloom == 68 then
					Datos2.Sprite.Set("Overworld/Objects/Aquatic Plant/3")
				elseif Datos2.Bloom == 76 then
					Datos2.Sprite.Set("Overworld/Objects/Aquatic Plant/4")
				elseif Datos2.Bloom == 84 then
					Datos2.Sprite.Set("Overworld/Objects/Aquatic Plant/5")
				elseif Datos2.Bloom == 92 then
					Datos2.Sprite.Set("Overworld/Objects/Aquatic Plant/6")
				elseif Datos2.Bloom == 100 then
					Datos2.Sprite.Set("Overworld/Objects/Aquatic Plant/7")
				end
			end
			if Datos2.Y >= -120 then
				Datos2.Y = Datos2.Y - 2
			elseif Datos2.Y >= -160 then
				Datos2.Y = Datos2.Y - 3
			else
				Datos2.Y = Datos2.Y - 4
			end
			Datos2.Sprite.MoveTo(Datos.X - 180 + 40*Datos2.X, River.y + 198 + Datos2.Y)
			if Datos2.Y <= -320 then
				Datos2.Sprite.Remove()
				table.remove(Datos.Flowers, j - tableaux2)
				tableaux2 = tableaux2 + 1
			end
		end
		if Datos.X >= 840 then
			for j=1,#Datos.Flowers do
				Datos.Flowers[j].Sprite.Remove()
			end
			Datos.Sprite.Remove()
			table.remove(Cascadas, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	for i=1,#Plants do
		local Datos = Plants[i - tableaux]
		Datos.X = Datos.X + 2
		Datos.Sprite.MoveTo(Datos.X, River.y + Datos.Y)
		for j=1,#Cascadas do
			local Datos2 = Cascadas[j]
			if Datos.X >= Datos2.X - 200 and Datos.X <= Datos2.X + 200 then
				Datos.Remove = true
			end
		end
		if Datos.X >= 660 or Datos.Remove then
			Datos.Sprite.Remove()
			table.remove(Plants, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	for i=1,#Stars do
		local Datos = Stars[i - tableaux]
		Datos.X = Datos.X + 2
		Datos.Move.Timer = Datos.Move.Timer + 1
		Datos.Sprite.MoveTo(Datos.X + Datos.Move.X/2 - Datos.Move.X/2*math.cos(math.rad(180/150*Datos.Move.Timer)), River.y + 240 + Datos.Y + Datos.Move.Y/2 - Datos.Move.Y/2*math.cos(math.rad(180/150*Datos.Move.Timer)))
		if Datos.Move.Timer >= 150 then
			Datos.X = Datos.X + Datos.Move.X
			Datos.Y = Datos.Y + Datos.Move.Y
			Datos.Move.X = math.random(-200, 200)
			Datos.Move.Y = math.min(math.max(Datos.Y + math.random(-200, 200), -230), 230) - Datos.Y
			Datos.Move.Timer = 0
		end
		if Datos.X >= 840 then
			Datos.Sprite.Remove()
			table.remove(Stars, i - tableaux)
			tableaux = tableaux + 1
		end
	end
	tableaux = 0
	if Text then
		Text.SendToTop()
	end
	if Text2 then
		Text2.SendToTop()
	end
	if Text3 then
		Text3.SendToTop()
	end
	if Black then
		Black.SendToTop()
	end
end

function OnHit()
	
end