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

@Initialize{
	SetAutoDeleteObject(true);
	SetShotDeleteEventEnable(EV_DELETE_SHOT_IMMEDIATE, true);
	SetShotDeleteEventEnable(EV_DELETE_SHOT_FADE, true);
}

@MainLoop{
	yield;
}

@Event{
	alternative(GetEventType)
	case(EV_DELETE_SHOT_IMMEDIATE){
		let bullet = GetEventArgument(0);
		
		AnimBulletDestroy(bullet,GetEventArgument(1));
	}
	case(EV_DELETE_SHOT_FADE){
		let bullet = GetEventArgument(0);
		
		AnimBulletDestroy(bullet,GetEventArgument(1));
	}
} 

task AnimBulletDestroy(bullet,xy){
	let c = GetShotDataInfoA1(ObjShot_GetImageID(bullet), TARGET_ENEMY, INFO_DELAY_COLOR);
	
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, GetMainStgScriptDirectory ~ "img/effect/deletebullet.png");
	Obj_SetRenderPriority(obj, 0.65);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	ObjRender_SetPosition(obj, xy[0], xy[1], 0);
	ObjRender_SetColor(obj,c[0],c[1],c[2]);

	ascent(a in 0..8){
		ObjSprite2D_SetSourceRect(obj, 32*a, 0, 32*(a+1), 32);
		ObjSprite2D_SetDestCenter(obj);
			
		wait(5);
	}
		
	Obj_Delete(obj);
}