예제 #1
0
파일: GameWorld.cpp 프로젝트: Soxs/PMRGame
void GameWorld::update(float delta) {

    scoreTextLabel->setPosition(this->convertToNodeSpace(CCDirector::sharedDirector()->convertToGL(ccp(100, 100))));
    
    scoreLabel->setString(std::to_string(scoreManager->getScore()));
    pointlocation = this->convertToNodeSpace(CCDirector::sharedDirector()->convertToGL(ccp(110, 130)));
    scoreLabel->setPosition(pointlocation);
    
    heartsprite->setPosition(this->convertToNodeSpace(CCDirector::sharedDirector()->convertToGL(ccp(30, 60))));
    
    healthLabel->setString(std::to_string(player->currentHealth));
	healthLabel->setPosition(this->convertToNodeSpace(CCDirector::sharedDirector()->convertToGL(ccp(114, 60))));
    
    //Update the player.
    player->update(delta);
    
    //Update all the npcs.
    for (Entity* e : *npcManager->getNpcs()) {
        if (IsType<Crowd>(e)) {
            Crowd* c = static_cast<Crowd*>(e);
            c->update(delta);
        } else if (IsType<Helicopter>(e)) {
            Helicopter* h = static_cast<Helicopter*>(e);
            h->update(delta);
        } else
            e->update(delta);
    }
    
    //Update all the broken buildings.
    for (BrokenStructure* b : *structureManager->getStructures()) {
        b->update(delta);
    }
    
}
예제 #2
0
void CrowdApp::update()
{
	mCrowd.update();
}