#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Koishi's Panel2"]
#Text["NewCutout"]
#include"./Cutin.txt"
let bossObj;
let bossX = 0;
let bossY = 0;
let animFrame = 0;
let animFrame2 = 0;
let objScene = GetEnemyBossSceneObjectID();
let imgBoss = GetCurrentScriptDirectory ~ "Gizmo's Touhou Boss Sprite Library/spriteimg/AyaDSSprite.png";
let overlay = GetCurrentScriptDirectory ~ "texture/spelloverlay.png";
let lake = GetCurrentScriptDirectory ~ "texture/spellbg.png";
let spellcardSFX = GetCurrentScriptDirectory ~ "sfx/SPELLCARD.wav";
let bdeathSFX = GetCurrentScriptDirectory ~ "sfx/DEFEATED.wav";
let snd = GetCurrentScriptDirectory ~ "./sfx/boss4a.mp3";
let objmusic = ObjSound_Create();


#include "./../shot/AllStarShot_Const.txt"
#include "script/default_system/Default_Effect.txt"
@Initialize {
	
	ObjSound_Load(objmusic,snd);
	ObjSound_Play(objmusic);
	// define a boss in bossObj and register it
	bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(bossObj);
	
	// warp the boss to this location when loaded
	
	
	// move boss to desired x y location at desired speed
	ObjMove_SetDestAtSpeed(bossObj,192,120,5);
	
	LoadSound(spellcardSFX);
	LoadSound(bdeathSFX);
	ObjEnemyBossScene_StartSpell(objScene);
	TFinalize;
	let patchy = GetCurrentScriptDirectory~"aya_cut.png";
	let kyouko = GetCurrentScriptDirectory~"cutin2.png";
	ObjCutin_SetSpellcardS4("Wind Sign''Autumn's Cold Wind''",patchy,MOKOU,240,104,104);
	ObjCutin_LaunchS3(NAZRIN, patchy, "Normal");
	mainTask;	// run mainTask
} 

@Event { 
	// setting the boss timer and life
	alternative(GetEventType()) 
	case(EV_REQUEST_LIFE) { 
		SetScriptResult(3000);
	}
	case(EV_REQUEST_SPELL_SCORE) { 
		SetScriptResult(1000);
	}
	case(EV_REQUEST_TIMER) { 
		SetScriptResult(45);
	}
} 

@MainLoop {
	bossX = ObjMove_GetX(bossObj);
	bossY = ObjMove_GetY(bossObj);
	
	// collision for the shots and player
	ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
	ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,32);
	
	yield;
} 

@Finalize {

} 

task TFinalize {
	while(ObjEnemy_GetInfo(bossObj,INFO_LIFE)>0){yield;}
	if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
        +ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0){
    AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
}
    PlaySE(bdeathSFX);
	TExplosionA(bossX,bossY,10,0.5);
	Obj_Delete(bossObj);
	DeleteShotAll(TYPE_ALL,TYPE_ITEM);
	SetAutoDeleteObject(true);
	CloseScript(GetOwnScriptID);
	return;
}

// your best friend, forever.
function wait(w) { loop(w) { yield; } } 

task mainTask { 
    renderBoss;
	renderBg;
	movement;
}
task renderBg {
	
	let scrollTex =0;
	
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,21);
	ObjPrim_SetTexture(obj,lake);
	ObjSprite2D_SetSourceRect(obj,0,0,1024/4,768/3);
	ObjSprite2D_SetDestRect(obj,0,0,GetStgFrameWidth,GetStgFrameHeight);
	ObjRender_SetAlpha(obj,90);
	
	let overlayObj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(overlayObj,21);
	ObjPrim_SetTexture(overlayObj,overlay);
	ObjRender_SetBlendType(overlayObj,BLEND_ADD_ARGB);
	ObjRender_SetAlpha(overlayObj,100);
	ObjSprite2D_SetSourceRect(overlayObj,0,0,512,512);
	ObjSprite2D_SetDestRect(overlayObj,0,0,GetStgFrameWidth,GetStgFrameHeight);
	
	while(!Obj_IsDeleted(bossObj)) {
		ObjSprite2D_SetSourceRect(overlayObj,0-scrollTex,0-scrollTex,512-scrollTex,512-scrollTex);
		scrollTex ++;
		yield;
	}
	Obj_Delete(overlayObj);
}
task renderBoss {
	let dir;
	let speed;
	
	// texture the boss, set centre as true centre.
	ObjPrim_SetTexture(bossObj,imgBoss);
	ObjSprite2D_SetSourceRect(bossObj,0,0,64,64);
	ObjSprite2D_SetDestCenter(bossObj);
	ObjRender_SetScaleXYZ(bossObj,1,1,0);
	
	while(!Obj_IsDeleted(bossObj)) {
		
		// update speed and location locally
		dir = ObjMove_GetX(bossObj);
		speed = ObjMove_GetSpeed(bossObj);
		
		// animate
		if(speed == 0) {
			if(animFrame < 15) {ObjSprite2D_SetSourceRect(bossObj,0,0,64,64); }
			if(animFrame >= 15 && animFrame <30) {ObjSprite2D_SetSourceRect(bossObj,64,0,128,64); }
			if(animFrame >= 30 && animFrame <45) {ObjSprite2D_SetSourceRect(bossObj,128,0,192,64); }
			if(animFrame >= 45) {ObjSprite2D_SetSourceRect(bossObj,192,0,256,64); }
			animFrame2 = 0;
			ObjRender_SetAngleXYZ(bossObj,0,0,0); 
		}   // boss holding location
		else if (cos(dir) < 0) { 
		    if(animFrame2 < 15) {ObjSprite2D_SetSourceRect(bossObj,0,64,64,128); }
			if(animFrame2 >= 15 && animFrame2 <30) {ObjSprite2D_SetSourceRect(bossObj,64,64,128,128); }
			if(animFrame2 >= 30 && animFrame2 <45) {ObjSprite2D_SetSourceRect(bossObj,128,64,192,128); }
			if(animFrame2 >= 45) {ObjSprite2D_SetSourceRect(bossObj,192,64,256,128); }
		    ObjRender_SetAngleXYZ(bossObj,0,0,0); 
		}    // boss moving to the left
		else if (cos(dir) > 0) { 
		    if(animFrame2 < 15) {ObjSprite2D_SetSourceRect(bossObj,0,64,64,128); }
			if(animFrame2 >= 15 && animFrame2 <30) {ObjSprite2D_SetSourceRect(bossObj,64,64,128,128); }
			if(animFrame2 >= 30 && animFrame2 <45) {ObjSprite2D_SetSourceRect(bossObj,128,64,192,128); }
			if(animFrame2 >= 45) {ObjSprite2D_SetSourceRect(bossObj,192,64,256,128); }
		    ObjRender_SetAngleXYZ(bossObj,0,180,0); 
		}  // boss moving to the right
		animFrame+=1.5;
		animFrame2+=2;
		if(animFrame >60) {animFrame = 0;}
		
		yield;
	}
}

task movement {
	wait(60);
	loop {
		fire;
		wall;
		wait(60);
		fire;
		wait(30);
		wall;
		wait(30);
		fire;
		wait(60);
	}
}

function angleToPlayer{
	let dir = atan2(GetPlayerY-bossY,GetPlayerX-bossX);
	return dir;
}
let angleT = 0;

task wall {
	loop(1) {
	CreateShotA1(GetPlayerX,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+20,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-20,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+40,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-40,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+60,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-60,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+80,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-80,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+100,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-100,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+120,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-120,0,rand(1,2),90,43,0);
	wait(5);
	CreateShotA1(GetPlayerX+140,0,rand(1,2),90,43,0);
	CreateShotA1(GetPlayerX-140,0,rand(1,2),90,43,0);
	}
}

task fire {
	loop(2.5) {
	let obj = CreateShotA1(GetPlayerX,0,3,90,59,0);
	let obj2 = CreateShotA1(0,GetPlayerY,3,90,59,0);
	let obj3 = CreateShotA1(GetStgFrameWidth,rand(0,GetStgFrameHeight),3,90,59,0);
	wind(obj,obj2,obj3);
	wait(24);
	}
}
task wind(obj,obj2,obj3) {
	loop {
	ObjMove_SetX(obj,ObjMove_GetX(obj)+10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+10);
	wait(2);	
		
	ObjMove_SetX(obj,ObjMove_GetX(obj)+9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+9);
	wait(2);	
		
	ObjMove_SetX(obj,ObjMove_GetX(obj)+8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+8);
	wait(2);	
		
	ObjMove_SetX(obj,ObjMove_GetX(obj)+7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+7);
	wait(2);	
		
	ObjMove_SetX(obj,ObjMove_GetX(obj)+6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+6);
	wait(2);	
		
	ObjMove_SetX(obj,ObjMove_GetX(obj)+5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+5);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+4);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+4);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+3);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+3);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+2);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+2);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+1);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+1);
	wait(90);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-1);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-1);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-2);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-2);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-3);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-3);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-4);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-4);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-5);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-6);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-7);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-8);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-9);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-10);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-10);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-9);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-8);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-7);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-6);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-5);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-4);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-4);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-3);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-3);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-2);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-2);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)-1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-1);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)-1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)-1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)-1);
	wait(90);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+1);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+1);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+1);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+1);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+2);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+2);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+2);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+2);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+3);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+3);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+3);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+3);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+4);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+4);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+4);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+4);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+5);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+5);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+5);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+5);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+6);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+6);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+6);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+6);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+7);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+7);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+7);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+7);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+8);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+8);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+8);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+8);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+9);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+9);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+9);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+9);
	wait(2);
	
	ObjMove_SetX(obj,ObjMove_GetX(obj)+10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+10);
	wait(2);
	ObjMove_SetX(obj,ObjMove_GetX(obj)+10);
	ObjMove_SetX(obj2,ObjMove_GetX(obj2)+10);
	ObjMove_SetX(obj3,ObjMove_GetX(obj3)+10);
	wait(2);
	}
}
































