예제 #1
0
void ZombieManager::createZombies(const vector<ZombieType> &v,	const vector<CCPoint> &vp)
{
	for(int i=0; i<(int)v.size(); ++i)
	{
		Zombie  *zombie = Zombie::createZombie(v[i], vp[i]);
		zombie->scheduleUpdate();
		this->addChild(zombie);
		// put into array
		m_Zombies.push_back(zombie);
	}
}
예제 #2
0
void ZombieManager::update(float delta)
{
	CCLOG("ZombieManager::update");
	
	// 以一定的概率产生僵尸
	if( m_probabiliy > rand()%1000 )
	{
		// generate A Zombie
		CCSize size = CCDirector::sharedDirector()->getVisibleSize();
		int y = rand() % static_cast<int>(size.height);
		Zombie *zombie = Zombie::createZombie(en_NormalZombie, ccp(size.width, y));
		zombie->scheduleUpdate();
		this->addChild(zombie);
		m_Zombies.push_back(zombie);

		//if(m_probabiliy < 100)
		//{
		//	++m_probabiliy;
		//}
	}
}