#“Œ•û’e–‹•—[Stage]
#Title[Stealing anything, anywhere, anytime]
#Text[Marisa: You got some nice stuff right there.
Can I have it?
Don't answer. I will take it anyways.]
#Image[]
#BackGround[]
#Player[.\Player\Mamizou.txt,FREE]
#ScriptVersion[2]
script_stage_main
{

let atardecer = GetCurrentScriptDirectory ~ "img\Noche.jpg";
let lados1 = GetCurrentScriptDirectory ~ "img\b.png";
let camino1 = GetCurrentScriptDirectory ~ "img\a.png";
let arbol1 = GetCurrentScriptDirectory ~ "img\4.png";

LoadGraphic(atardecer);
LoadGraphic(lados1);
LoadGraphic(camino1);
LoadGraphic(arbol1);

SetCommonData("norm",false);
SetCommonData("luna",false);
SetCommonData("notrans",false);
SetCommonData("robado",0);
SetCommonData("gafas",false);

		let a = 0;
		let scale=1.4;
		let b = 0;
		let c = 0;
                let s=0;
	        let count=0;
	        let i=0;

		

task Seleccionar_dificultad{
CreateEventFromScript("difi");
while(OnEvent){ForbidShot(true);ForbidBomb(true);yield;}
Stage;
}


		task Stage{
ForbidShot(false);ForbidBomb(false);
PlayMusic(GetCurrentScriptDirectory ~ "se\(UNL) Love-coloured Magic.mp3");
		function Wait( let frame ){ loop( frame ){ yield }; }
		function WaitForZeroEnemy(){ while( GetEnemyNum() != 0 ){ yield; } }
		Wait( 1 );

if(GetCommonData("norm")==true){
   CreateEnemyBossFromFile(GetCurrentScriptDirectory~"1N-Ze.txt", 0, 0, 0, 0, 0);
	WaitForZeroEnemy();
if(GetPlayerType == USER_PLAYER && GetPlayerScriptName =="Mamizou.txt" && GetCommonData("gafas")==true){
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"1N-Spell3M.txt", GetCenterX, GetClipMinY + 120, 0, 0, 0);
}else{CreateEnemyBossFromFile(GetCurrentScriptDirectory~"1N-Spell3.txt", GetCenterX, GetClipMinY + 120, 0, 0, 0);}
}
if(GetCommonData("luna")==true){
   CreateEnemyBossFromFile(GetCurrentScriptDirectory~"3L-Ze.txt", 0, 0, 0, 0, 0);
	WaitForZeroEnemy();
if(GetPlayerType == USER_PLAYER && GetPlayerScriptName =="Mamizou.txt" && GetCommonData("gafas")==true){
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"3L-Spell3M.txt", GetCenterX, GetClipMinY + 120, 0, 0, 0);
}else{CreateEnemyBossFromFile(GetCurrentScriptDirectory~"3L-Spell3.txt", GetCenterX, GetClipMinY + 120, 0, 0, 0);}
}
		WaitForZeroEnemy();
		Wait(300);
                Clear();
		}

////////////////////////////////

task Fondo1{
a++;
         b++;
	if(b==150){b=0;}
//atardecer
                        SetTexture(atardecer);
                        SetGraphicAngle(0, 0, 0);
                        SetGraphicScale(0.5, 0.5);
                        SetAlpha(255);
                        SetGraphicRect(0, 0, 910, 719);
                        DrawGraphic(GetCenterX, GetCenterY-130);



			SetPerspectiveClip(100, 1500);		
			SetFog(200, 700, 0,0,0);			
			SetViewTo(0+5*sin(a*0.1), 0, 0);
			SetViewFrom(500, 90, 45);

//pasto
			SetTexture(lados1);
			SetGraphicRect(0,0-a,900,900-a);
			SetGraphicAngle(50,0,0);
			SetColor(0,255,0);
			SetGraphicScale(1,1);
			SetRenderState(ALPHA);
			SetAlpha(255);
			DrawGraphic3D(0,0,160);

//camino
			SetTexture(camino1);
			SetGraphicRect(0,0-a,150,900-a);
			SetGraphicAngle(50,0,0);
			SetColor(255,255,255);
			SetGraphicScale(1,1);
			SetRenderState(ALPHA);
			SetAlpha(255);
			DrawGraphic3D(0,0,160);


//arboles
			SetTexture(arbol1);
			SetGraphicRect(0,0,336,300);
			SetGraphicAngle(120,0,0);
			SetColor(255,255,255);
			SetGraphicScale(scale,1);
			SetRenderState(ALPHA);
			SetAlpha(255);
			DrawGraphic3D(0,-150+b,-150+b);

			SetTexture(arbol1);
			SetGraphicRect(0,0,336,300);
			SetGraphicAngle(120,0,0);
			SetColor(255,255,255);
			SetGraphicScale(scale,1);
			SetRenderState(ALPHA);
			SetAlpha(255);
			DrawGraphic3D(0,b,b);

			SetTexture(arbol1);
			SetGraphicRect(0,0,336,300);
			SetGraphicAngle(120,0,0);
			SetColor(255,255,255);
			SetGraphicScale(scale,1);
			SetRenderState(ALPHA);
			SetAlpha(255);
			DrawGraphic3D(0,150+b,150+b);



if (a > 0){
a -= 0.01;
}
if (a < 100){
a += 0.1;
}
}

///////////////////////////////////////
		

	@Initialize
	{
                Seleccionar_dificultad;
	}
	
	@MainLoop
	{


                yield;
	}
	
	@DrawLoop{

	}

	@BackGround{
Fondo1;
	}

	@Finalize
	{
	}

}


/////////////////////////////////

script_event difi
{
	@Initialize{}
		
        @MainLoop{
              let select=0;
              select=Select("Normal","Lunatic");
              if(select==1){
                  SetCommonData("norm",true);      
                  End();
              }
              if(select==2){
                  SetCommonData("luna",true);      
                  End();
              }
                  }
              }
          }


	  @Finalize{}
}
