本文整理汇总了C++中Light::IsTouched方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::IsTouched方法的具体用法?C++ Light::IsTouched怎么用?C++ Light::IsTouched使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::IsTouched方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void Game::update(float dt) {
//clean out out of bounds platforms
int platCount = platforms.size();
if(platCount > 0){
GameObject *obj = platforms.front();
b2Vec2 pos = obj->getBody()->GetPosition();
if(obj->isOffScreen()){
Light* l = (Light*)obj;
if(!l->IsTouched()){
_stats.IncrementMultiplier(1);
_stats.IncrementScore(10);
}
//obj->removeFromParentAndCleanup();
platforms.erase(platforms.begin());
}
}
_player->updateTrail(dt);
//It is recommended that a fixed time step is used with Box2D for stability
//of the simulation, however, we are using a variable time step here.
//You need to make an informed choice, the following URL is useful
//http://gafferongames.com/game-physics/fix-your-timestep/
int32 velocityIterations = 8;
int32 positionIterations = 1;
// Instruct the world to perform a single step of simulation. It is
// generally best to keep the time step and iterations fixed.
world->Step(dt, velocityIterations, positionIterations);
CleanWorld();
if(move==false){
spawnrate+=dt;
if(spawnrate>=1){
spawnrate=0.5;
CCDirector::sharedDirector()->getActionManager()->resumeTarget(_boss->getSprite());
move=true;
}
}
else{
spawnrate-=dt;
if((spawnrate<=0)&&(_boss->getSprite()->getPositionY()<winSize.height*0.1+0.5*winSize.height)){//err:doesn't account for change in players height on new platform
GameObject* test = GameObject::retainedObjectWithSprite(Light::retainedLight());
test->getSprite()->setPosition(ccp(_boss->getSprite()->getPositionX()+50, _boss->getSprite()->getPositionY()));
this->addChild(test->getSprite());
test->createBox2dObject(world);
test->getBody()->SetLinearVelocity(b2Vec2(-5.0f, 0.0f));
test->getBody()->SetType(b2_kinematicBody);
//test->getSprite()->runAction(CCMoveBy::create( 4 ,ccp(-winSize.width*1.5, 0)));
spawnrate=0;
platforms.push_back(test);
CCDirector::sharedDirector()->getActionManager()->pauseTarget(_boss->getSprite());
move=false;
CCLog("%i", _batchNode->getChildrenCount());//err:gameobjects arent autoreleased(coz it doesnt work dunno wtf- cocos releases them too early maybe?) so makesure to release when done - check/confirm memusage with this print
}
}
}