#include "./functions.txt"

task ObjEffect_Shadow
{	TObj(0);
	TObj(1/32);
	task TObj(scaleM)
		{
		let img = GetCurrentScriptDirectory ~ "system/img/Sprite_Suwako_Frog.png";
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,img);
		ObjSprite2D_SetSourceRect(obj,0,0,256,256);
		Obj_SetRenderPriorityI(obj,26-scaleM*32);	
		ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
		ObjRender_SetAlpha(obj,150);
		if(scaleM > 0)
			{
			ObjRender_SetColorHSV(obj,180,255,255);
			}
		let scale = 1/16;
		let scaleA = 180;
		while(ObjEnemy_GetInfo(objEnemy,INFO_LIFE) > 0)
			{
			ObjRender_SetPosition(obj,enmx,enmy,0);
			ObjRender_SetScaleXYZ(obj,scale+(1/16)*cos(scaleA+scaleM)+scaleM,scale+(1/16+scaleM)*cos(scaleA)+scaleM,0);
			ObjSprite2D_SetDestCenter(obj);
			scaleA+=180/37.5;
			if(scale < 0.45)
				{
				scale+=0.45/30;
				}	
			else
				{
				scale = 0.45;
				}
			yield;
			}
		Obj_Delete(obj);
		}

}

task ObjEnemy_Render
{
	let imgBoss = GetCurrentScriptDirectory ~ "system/img/Sprite_Suwako.png";
	let x = 0; 
	let y = 0;
	let anim = 0;
	let move = 0;
	let spell = 0;

	while(!Obj_IsDeleted(objEnemy))
		{
		anim+=0.125;	
		if(EnemyMotion == true && ObjMove_GetSpeed(objEnemy) > 0.1)
			{
			anim = 0;
			spell = 0;
			if(move < 3)
				{
				move+=0.175;
				}
			x = 64*floor(move);
			y = 64;
			}
		else if(EnemySpell2 == true)
			{
			move = 0;
			spell = 0;
			x = 64*floor(anim);
			y = 64*3;
			}
		else if(EnemySpell == true)
			{
			anim = 0;
			move = 0;
			if(spell < 3)
				{
				spell+=0.175;
				}
			x = 64*floor(spell);
			y = 64*2;
			}
		else
			{
			move = 0;
			spell = 0;
			x = 64*floor(anim);
			y = 0;
			}
		if(cos(ObjMove_GetAngle(objEnemy)) < 0)
			{
			ObjRender_SetScaleX(objEnemy,-absolute(ObjRender_GetScaleX(objEnemy)));
			}
		else
			{
			ObjRender_SetScaleX(objEnemy,absolute(ObjRender_GetScaleX(objEnemy)));
			}
		ObjPrim_SetTexture(objEnemy,imgBoss);
		ObjSprite2D_SetSourceRect(objEnemy,x,y,x+64,y+64);
		ObjSprite2D_SetDestCenter(objEnemy);
		yield;
		}
}