Esempio n. 1
0
Barrier* Barrier::create(int type)
{
	Barrier *pRet = new(std::nothrow) Barrier();
	if (pRet && pRet->init(type))
	{
		pRet->autorelease();
		return pRet;
	}
	else
	{
		delete pRet;
		pRet = nullptr;
		return nullptr;
	}
}
Esempio n. 2
0
Barrier * Barrier::creates( std::string pname,int barrierIndex,int barrierBlood){//敌机类
	//创建敌方坦克
	Barrier *barrier = new Barrier();
	if (barrier->initWithFile(pname.c_str())){
		//初始障碍物的类型信息
		barrier->barrierIndex = barrierIndex;
		//障碍物的血量
		barrier->barrierBlood = barrierBlood;
		//设置为系统自动管理
		barrier->autorelease();
		//获取图片大小
		barrier->barrierSize = barrier->getContentSize();
		return barrier;
	}
	CC_SAFE_DELETE(barrier);//清除资源
	return NULL;
}