#include "CS_SantaGhostFireBladeSpark.h"

CS_SantaGhostFireBladeSpark::CS_SantaGhostFireBladeSpark()
{
	//类型
	type = 3;
	//初始化变量
	A = (float)(rand() % 2 == 0 ? 1 : -1);
	B = (float)(rand() % 9);
	C = (rand() % 6 + 2) / 10.0f;
	D = rand() % 5 + 2.0f;
	//贴图
	ani.sprite_index = L"am_ghostfire_spark";
	ani.image_index = 9;
}

void CS_SantaGhostFireBladeSpark::Step()
{
	//设置贴图
	if (ani.png.length() == 0)
		ani.png = L"CS_CaveStoryMod";
	//执行运动
	Entity::Step();
	x += A * B * (sinf(angle * deg2rad) - sinf((angle + D) * deg2rad));
	y -= C;
	angle += D;
	if (ani.image_index == 3)
		Destroy();
}
