
let objScene = GetEnemyBossSceneObjectID;
function NormalizeAngle(anglee){
  anglee %= 360;
  if(anglee<0){ anglee += 360; }
  return anglee;
}
function TrulyRandomInt(a, b) {
return floor(rand(min(a, b), max(a, b) + 1));
}

function GetClipMaxX{return GetStgFrameWidth;}
function GetClipMaxY{return GetStgFrameHeight;}

function GetCenterX{return GetStgFrameWidth/2;}
function GetCenterY{return GetStgFrameHeight/2;}

function GetClipMinX{return 0;}
function GetClipMinY{return 0;}

function GetLineBorderPoint(px, py, tx, ty){

	let ta = atan2(ty-py, tx-px);

	if( ta>= atan2(GetClipMinY - py, GetClipMinX - px) && ta<=  atan2(GetClipMinY - py, GetClipMaxX - px)){
		return [px - (GetClipMinY-py)*tan(ta+90), GetClipMinY];
	}
	if( ta>= atan2(GetClipMinY - py, GetClipMaxX - px) && ta<=  atan2(GetClipMaxY - py, GetClipMaxX - px)){
		return [GetClipMaxX, py + (GetClipMaxX-px)*tan(ta)];
	}
	if( ta>= atan2(GetClipMaxY - py, GetClipMaxX - px) && ta<=  atan2(GetClipMaxY - py, GetClipMinX - px)){
		return [px - (GetClipMaxY-py)*tan(ta-90), GetClipMaxY];
	}
	if( ta> atan2(GetClipMaxY - py, GetClipMinX - px) || ta<  atan2(GetClipMinY - py, GetClipMinX - px)){
		return [GetClipMinX, py + (GetClipMinX-px)*tan(ta+180)];
	}
}



function ObjX(obj){return ObjMove_GetX(obj);}
function ObjY(obj){return ObjMove_GetY(obj);}
function angletoplayer(obj){
	let angle=atan2(GetPlayerY-ObjMove_GetY(obj),GetPlayerX-ObjMove_GetX(obj));
	return angle;
}

function exp(x)
{
 real e = 2.71828;
 return e ^ x
}

function Ring(x, y, v, ang, graphic, delay, radius, number){
loop(number){
CreateDNHShotA1(x+radius*cos(angle2), y+radius*sin(angle2), v, ang, graphic, delay);
angle2+=360/number;
}
}    

function ExMoveBarely { ExMoveBarely_(GetClipMinY+120, 10, rand(15, 25)); }
function ExMoveBarely_(height, ud, length) {
if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0){
	if(GetPlayerX < GetEnemyX) {
		if(GetEnemyX - length <= GetClipMinX+20) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+10, rand(height+4 - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-10, rand(height - ud, height + ud), 15, 3);
		}
	} else {
		if(GetEnemyX + length >= GetClipMaxX-20) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-10, rand(height - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+10, rand(height - ud, height + ud), 15, 3);
		}
	}
}
}

function ExMove { ExMove_(GetClipMinY+120, 10, rand(40, 60)); }
function ExMove_(height, ud, length) {
if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0){
	if(GetPlayerX < GetEnemyX) {
		if(GetEnemyX - length <= GetClipMinX+20) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height+4 - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 3);
		}
	} else {
		if(GetEnemyX + length >= GetClipMaxX-20) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height - ud, height + ud), 15, 3);
		}
	}
}
}

function ExMoveASDF { ExMoveA_(GetClipMinY+90, 10, rand(40, 60)); }
function ExMoveA_(height, ud, length) {
if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0){
	if(GetPlayerX < GetEnemyX) {
		if(GetEnemyX - length <= GetClipMinX+20) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height+4 - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 3);
		}
	} else {
		if(GetEnemyX + length >= GetClipMaxX-20) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height - ud, height + ud), 15, 3);
		}
	}
}
}


function ExMoveSlow { ExMoveSlow_(GetClipMinY+120, 10, rand(55, 75)); }
function ExMoveSlow_(height, ud, length) {
if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0){
	if(GetPlayerX < GetEnemyX) {
		if(GetEnemyX - length <= GetClipMinX+40) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height+4 - ud, height + ud), 15, 1);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 1);
		}
	} else {
		if(GetEnemyX + length >= GetClipMaxX-40) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 1);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height - ud, height + ud), 15, 1);
		}
	}
}
}

function ExMoveNon { ExMoveNon_(GetClipMinY+120, 10, rand(40, 60)); }
function ExMoveNon_(height, ud, length) {
if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0){
	if(GetPlayerX < GetEnemyX) {
		if(GetEnemyX - length <= GetClipMinX+75) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height+4 - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 3);
		}
	} else {
		if(GetEnemyX + length >= GetClipMaxX-75) {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX - length-20, rand(height - ud, height + ud), 15, 3);
		} else {
			ObjMove_SetDestAtWeight(objEnemy, GetEnemyX + length+20, rand(height - ud, height + ud), 15, 3);
		}
	}
}
}

function GetDistance(x1,y1,x2,y2){return( ((x2-x1)^2+(y2-y1)^2)^0.5);}

function GetLife(obj){
if(!Obj_IsDeleted(obj)){return ObjEnemy_GetInfo(obj,INFO_LIFE);}
else{return 0;}
}

function GetTimer{
return ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID,INFO_TIMERF);
}



function GetAngleToPoint(sourceX,sourceY,tarGetEnemyX,targetY){
let angletopoint=atan2(targetY-sourceY,tarGetEnemyX-sourceX);
return angletopoint;}

function wait(w){loop(w){yield;}}


function MoveFrames(Object,X,Y,frames){ObjMove_SetDestAtFrame(Object,X,Y,frames);}


 

let GetEnemyX = 0;
let GetEnemyY = 0;
let popped = false;

let iceblock = GetCurrentScriptDirectory~"sfx/iceblock.wav";
let firecast = GetCurrentScriptDirectory~"sfx/fireprecast.wav";
let frostcast = GetCurrentScriptDirectory~"sfx/frostprecast.wav";
let arcanecast = GetCurrentScriptDirectory~"sfx/arcaneprecast.wav";
let fireball = GetCurrentScriptDirectory~"sfx/fireball.wav";
let arcaneblast = GetCurrentScriptDirectory~"sfx/arcaneblast.wav";
let arcaneexplosion = GetCurrentScriptDirectory~"sfx/arcaneexplosion.wav";
let coneofcold = GetCurrentScriptDirectory~"sfx/coneofcold.wav";
let flamestrike = GetCurrentScriptDirectory~"sfx/flamestrike.wav";
let counterspell = GetCurrentScriptDirectory~"sfx/counterspell.wav";
let dragonsbreath = GetCurrentScriptDirectory~"sfx/dragonsbreath.wav";
let bgm = GetCurrentScriptDirectory~"bgm/bgm.ogg";
let shot = GetCurrentScriptDirectory~"sfx/shot.wav";
let charge2 = GetCurrentScriptDirectory~"sfx/Charge2.wav";
let charge = GetCurrentScriptDirectory~"sfx/Charge.wav";
let shot2 = GetCurrentScriptDirectory~"sfx/shot2.wav";
let shot3 = GetCurrentScriptDirectory~"sfx/shot3.wav";
let shot4 = GetCurrentScriptDirectory~"sfx/shot4.wav";
let laser = GetCurrentScriptDirectory~"sfx/laser.wav";
let cardcall = GetCurrentScriptDirectory~"sfx/cardcall.wav";
let frostslow = GetCurrentScriptDirectory~"sfx/frostslow.wav";
let ping = GetCurrentScriptDirectory~"sfx/ping.wav";
let slash = GetCurrentScriptDirectory~"sfx/slash.wav";
let weird = GetCurrentScriptDirectory~"sfx/Shadow.wav";
let timeslow = GetCurrentScriptDirectory~"sfx/timeslow.wav";
let skillcall = GetCurrentScriptDirectory~"sfx/skillcall.wav";
let boom = GetCurrentScriptDirectory~"sfx/se_enep01.wav";
let stealth = GetCurrentScriptDirectory~"sfx/stealth.wav";
let GCSD = GetCurrentScriptDirectory;
function PlaySE2(sound, vol){
	let SoundObject=ObjSound_Create;
		ObjSound_Load(SoundObject,sound);
		ObjSound_Play(SoundObject);
		ObjSound_SetSoundDivision(SoundObject,SOUND_SE);
		ObjSound_SetVolumeRate(SoundObject,vol);
		loop(200){ yield; }
		ObjSound_Stop(SoundObject);
		Obj_Delete(SoundObject);
	}

task BottomEnemyMarker(obj, bossobj){
  let imgnumber = GetCurrentScriptDirectory~"sprites/enemymarker.png";
  let objMarker = ObjPrim_Create(OBJ_SPRITE_2D);
  ObjRender_SetPosition(objMarker, GetCenterX, GetStgFrameHeight+32, 1); 
  ObjPrim_SetPrimitiveType(objMarker, PRIMITIVE_TRIANGLESTRIP);
  ObjRender_SetBlendType(objMarker, BLEND_ALPHA);
  Obj_SetRenderPriority(objMarker, 0.85);
  ObjPrim_SetTexture(objMarker, imgnumber);
  ObjRender_SetAlpha(objMarker, 255);
  ObjSprite2D_SetSourceRect(objMarker, 0, 0, 48, 16);
  ObjSprite2D_SetDestRect(objMarker, -25, -8, 25, 8);
  while(ObjEnemy_GetInfo(bossobj,INFO_LIFE)>0){
    ObjRender_SetPosition(objMarker, ObjMove_GetX(obj)+32, GetStgFrameHeight+24, 1);
    yield;
  }
  //wait(60); //So it doesn't look like they disappear in between attacks. IN PH3 THIS DOES NOT WORK WITHOUT AUTODELETE OF OBJECTS.
  wait(12);//It can only handle 12 yields, currently, before the script is closed.
  Obj_Delete(objMarker);
}
	
function CreateSprite ( let texture, let priorityInt, let rects, let center ) {
		// rects = 1-dimensional, size 4
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj, texture);
		Obj_SetRenderPriorityI(obj, priorityInt);
		ObjSprite2D_SetSourceRect(obj, rects[0], rects[1], rects[2], rects[3]);
		ObjSprite2D_SetDestRect(obj, -center[0], -center[1], rects[2]-rects[0]-center[0], rects[3]-rects[1]-center[1]);
		return obj;
	}
	
	function ObjRender_SetPosition2D ( let obj, let posX, let posY ) {
		ObjRender_SetX(obj, posX);
		ObjRender_SetY(obj, posY);
	}
	
	function ObjRender_SetScaleXY ( let obj, let scaleX, let scaleY ) {
		ObjRender_SetScaleX(obj, scaleX);
		ObjRender_SetScaleY(obj, scaleY)	
	}
	
function TCharge01(boss,size,frame,r,g,b){ // Draw a charge circle that has an acceleration on shrinking
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	let img=GetCurrentScriptDirectory~"sprites/charge.png";
	let set = 360/(frame*4);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,128,128);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,ObjMove_GetX(boss),ObjMove_GetY(boss),0);
	ObjRender_SetAlpha(obj,0);
	ObjRender_SetColor(obj, r, g, b);
	ObjRender_SetScaleXYZ(obj,size,size,0);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	Obj_SetRenderPriorityI(obj,25);
	TAlpha;
	TShrink;
	return obj;
	task TAlpha{
		let l=10;
		let alpha=255/l;
		loop(l){
			ObjRender_SetAlpha(obj,alpha);
			alpha+=255/(l*2);
			yield;
			}
		}
	task TShrink{
		let l=frame;
		let a = size*2/l/l;
		ascent(i in 0..l){
			ObjRender_SetScaleXYZ(obj,size,size,0);
			ObjRender_SetPosition(obj,ObjMove_GetX(boss),ObjMove_GetY(boss),0);
			//ObjRender_SetColor(obj,0,128+64*sin(i*set+240),64+64*sin(i*set+0));
			size = size-i*a;
			if(Obj_IsDeleted(objEnemy)){Obj_Delete(obj);}
			yield;
			}
		Obj_Delete(obj);
		
	}
}

function TExpan(px,py,maxv,t,r,g,b, alpha){
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	let img=GetCurrentScriptDirectory~"sprites/charge.png";
	let scale = 0;
	let v = 0;
	let time = 0;
	let alpha2 = 255;
	let alpha3 = 0;
	let malpha = 255/t;
	ObjPrim_SetTexture(obj,img);
	ObjRender_SetAlpha(obj, alpha);
	ObjSprite2D_SetSourceRect(obj,0,0,128,128);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,px,py,0);
	ObjRender_SetColor(obj,r,g,b);
	Obj_SetRenderPriorityI(obj,55);
	Expan;
		task Expan{
			descent(i in 0..t){
			if(time>=50){ alpha2 = malpha*i; alpha3 = alpha2; loop(10){ alpha2-=alpha3/10; ObjRender_SetAlpha(obj, alpha2); wait(1); } break;}
			ObjRender_SetAlpha(obj,malpha*i);
			v = (i*maxv/2)/(t*t);
			scale += v;
			ObjRender_SetScaleXYZ(obj,scale,scale,0);
			yield;
			time++;
			}
			Obj_Delete(obj);
		}
	}

task ScreenShake(shaketime, intensity){
		let screenx = Get2DCameraX;
		let screeny = Get2DCameraY;
		let x = GetCameraFocusX;
		let y = GetCameraFocusY;
		let z = GetCameraFocusZ;
		let roll = 0;
		while(shaketime>0){
			Set2DCameraFocusX(screenx + rand(-intensity, intensity));
			Set2DCameraFocusY(screeny + rand(-intensity, intensity));
			//SetCameraFocusXYZ(rand(-intensity, intensity),rand(-intensity, intensity),rand(-intensity, intensity));
			//SetCameraRoll(GetCameraRoll+360/25);	
			shaketime--;
			yield;
		}
		Set2DCameraFocusX(screenx);
		Set2DCameraFocusY(screeny);
		yield;
	}

task ScreenDistort(EnemyObject, AI, length){
	let renderTexture = GetReservedRenderTargetName(0);

	SetInvalidRenderPriorityA1(20, 79);

	let objCurentFrame = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(objCurentFrame, 80);

	if(length == -1){while(ObjEnemy_GetInfo(EnemyObject, INFO_LIFE) > 0){PerformActions;yield;}}	
	if(length != -1){while(length>0){length--;PerformActions;yield;}}
	
	Obj_Delete(objCurentFrame);
	ClearInvalidRenderPriority;
	
	task PerformActions{
		let currentFrameTexture = renderTexture;
		RenderToTextureA1(currentFrameTexture, 20, 79, true);
		ObjPrim_SetTexture(objCurentFrame, currentFrameTexture);
		ObjSprite2D_SetSourceRect(objCurentFrame, 32, 16, 416, 464);
		ObjSprite2D_SetDestRect(objCurentFrame, rand(32, 36+AI), rand(16, 36+AI), rand(416-AI, 416), rand(464-AI, 464));
	}
}

task Invuln(duration, shot, bomb){ 
ObjEnemy_SetDamageRate(objEnemy, 0, 0);
wait(duration);
ObjEnemy_SetDamageRate(objEnemy,shot,bomb);
}

task magiccircle(boss,size,type){ // draw magic circle
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	let imgcircle=GetCurrentScriptDirectory~"sprites/MG.png";
	let spin = 0;
	let s = 0;
	LoadTexture(imgcircle);
	ObjPrim_SetTexture(obj,imgcircle);
	ObjSprite2D_SetSourceRect(obj,0,0,256,256);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,size,size,size);
	ObjRender_SetAlpha(obj,192);
	Obj_SetRenderPriorityI(obj, 28);
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	while(!Obj_IsDeleted(boss)){
	spin += 2;
	let timer = ObjEnemyBossScene_GetInfo(GetEnemyBossSceneObjectID, INFO_TIMERF);
	ObjRender_SetAngleXYZ(obj,0,0,spin*2);
	ObjRender_SetPosition(obj,ObjMove_GetX(boss),ObjMove_GetY(boss),0);
	ObjRender_SetColor(obj,1*(192+42*sin(spin+180)),1*(192+42*sin(spin)),0);
	if(type==true){
	ObjRender_SetScaleXYZ(obj,size*1.1+0.1*sin(spin),size*1.1+0.1*sin(spin),0);
	}
	ObjMove_SetPosition(obj,GetEnemyX,GetEnemyY);
	yield;
	}
	Obj_Delete(obj);
	}
	
let TIME_NEVERDELETE = 2^20;
let VALUE_SHOT_TYPE = "Object Type";
	let VALUE_SHOT_LASERWIDTH = "Laser Width";
	let VALUE_ITEM_MAKEITEM = "Object Delete Make Item";
function CreateDNHShotA1 ( let x, let y, let v, let angle, let graphic, let delay ) {
	if(GetCommonData("bullettype", 1)==0){
	CreateShotA1(x, y, v, angle, graphic, delay);
	}
	else{
	let obj = CreateShotA1(x, y, 0, angle, graphic, 0);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	CreateDelayCloud(obj, v, angle, 0, 0, graphic, delay);
	ObjRender_SetAlpha(obj, 0);
	return obj;
	}
}




function CreateDNHShotA2 ( let x, let y, let v, let angle, let vAcc, let vF, let graphic, let delay ) {
if(GetCommonData("bullettype", 1)==0){
	CreateShotA2(x, y, v, angle, vAcc, vF, graphic, delay);
	}
	else{
	let obj = CreateShotA2(x, y, 0, angle, 0, 0, graphic, 0);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	CreateDelayCloud(obj, v, angle, vAcc, vF, graphic, delay);
	ObjRender_SetAlpha(obj, 0);
	return obj;
	}
}
function CreateDNHShotA3 ( let x, let y, let v, let angle, let vAcc, let vF, let graphic, let delay ) {

	let obj = CreateShotA2(x, y, 0, angle, 0, 0, graphic, 0);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	CreateDelayCloud(obj, v, angle, vAcc, vF, graphic, delay);
	ObjRender_SetAlpha(obj, 0);
	return obj;
	
}

function CreateDNHShotOA1 ( let target, let v, let angle, let graphic, let delay ) {
	let obj = CreateShotOA1(target, 0, angle, graphic, 0);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	CreateDelayCloud(obj, v, angle, 0, 0, graphic, delay);
	ObjRender_SetAlpha(obj, 0);
	return obj;
}

function CreateDNHShotOA2 ( let target, let v, let angle, let vAcc, let vF, let graphic, let delay ) {
	let obj = CreateShotA2(ObjMove_GetX(target), ObjMove_GetY(target), 0, angle, 0, 0, graphic, 0);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	CreateDelayCloud(obj, v, angle, vAcc, vF, graphic, delay);
	ObjRender_SetAlpha(obj, 0);
	return obj;
}

function CreateDNHLooseLaserA1 ( let x, let y, let v, let angle, let length, let width, let graphic, let delay ) {
	let obj = CreateLooseLaserA1(x, y, v, angle, length, width, graphic, delay);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	Obj_SetValue(obj, VALUE_SHOT_LASERWIDTH, width);
	return obj;
}

function CreateDNHStraightLaserA1 ( let x, let y, let angle, let length, let width, let delete, let graphic, let delay ) {
	let obj = CreateStraightLaserA1(x, y, angle, length, width, delete, graphic, delay);
	Obj_SetValue(obj, VALUE_SHOT_TYPE, Obj_GetType(obj));
	Obj_SetValue(obj, VALUE_SHOT_LASERWIDTH, width);
	return obj;
}

let pathShotsheet = GetCurrentScriptDirectory~"lib/SHOT_REPLACE/shot_all.png";
task CreateDelayCloud ( let obj, let v, let angle, let vAcc, let vF, let graphic, let delay ) {
	let rects = GetShotDataInfoA1(graphic, TARGET_ENEMY, INFO_RECT);
	let frames = 0;
	let objCloud = CreateSprite (pathShotsheet, GetShotRenderPriorityI, rects, [(rects[2]-rects[0])/2, (rects[3]-rects[1])/2] );
	if(delay > 0) {
		ObjRender_SetBlendType(objCloud, GetShotDataInfoA1(graphic, TARGET_ENEMY, INFO_BLEND));
		ObjRender_SetAngleZ(objCloud, ObjMove_GetAngle(obj)+90);
		descent(i in 0..delay) {
			ObjRender_SetPosition(objCloud, ObjMove_GetX(obj), ObjMove_GetY(obj), NULL);
			ObjRender_SetAlpha(objCloud, 255*cos(i*90/delay));
			ObjRender_SetScaleXYZ(objCloud, 2-cos(i*90/delay), 2-cos(i*90/delay), NULL);
			if(Obj_IsDeleted(obj)==true || popped==true) { Obj_Delete(objCloud); yield; return; }
			wait(1);
		}
	} else {
		yield;
		frames++;
	}
	Obj_Delete(objCloud);
	ObjRender_SetAlpha(obj, 255);
	ObjMove_SetSpeed(obj, v);
	ObjMove_SetAcceleration(obj, vAcc);
	ObjMove_SetMaxSpeed(obj, vF);
}	