当前位置: 首页>>代码示例>>C++>>正文


C++ setScore函数代码示例

本文整理汇总了C++中setScore函数的典型用法代码示例。如果您正苦于以下问题:C++ setScore函数的具体用法?C++ setScore怎么用?C++ setScore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setScore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

void NewScene::selectedEvent(Ref *pSender, ui::CheckBox::EventType type)
{
	Point origin = Director::getInstance()->getVisibleOrigin();
	Size visibleSize = Director::getInstance()->getVisibleSize();

	switch (type)
	{
	case cocos2d::ui::CheckBox::EventType::SELECTED:

		setScore(getScore() + 1);
		
		break;
	case cocos2d::ui::CheckBox::EventType::UNSELECTED:
		//log("checkbox deseleccionado");
		//i -=1;
		setScore(getScore() - 1);

		break;
	default:
		break;
	}



}
开发者ID:Johan08,项目名称:cocos2d-x-3.2-ui-,代码行数:25,代码来源:NewScene.cpp

示例2: SDL_GetTicks

void            SdlDisplay::sdlChangeEvent(bool multi)
{
    if (!gticks)
    {
        startticks = SDL_GetTicks();
        gticks = true;
    }
    if ((!p2score || p2score) && multi)
    {
        sdlDrawFont(114, 166, 65, 10, 570, fontscore, 30, setScore(score, "P1"));
        sdlDrawFont(114, 166, 65, 550, 570, fontscore, 30, setScore(p2score, "P2"));
    }
    if ((!score || score) && !multi)
    {
        sdlDrawFont(114, 166, 65, 10, 570, fontscore, 30, setScore(score, "P1"));
        sdlDrawFont(114, 166, 65, 650, 570, fontscore, 30, "Nibbler");
    }
    if (pause && !gameover)
    {
        sdlSetRect(&rtmp, 0, 0, 0, 0);
        SDL_BlitSurface(menu, NULL, screen, &rtmp);
    }
    if (gameover)
    {
        if (!pause)
        {
            son = Mix_LoadWAV("music/game-over.wav");
            Mix_PlayChannel(1, son, 0);
        }
        pause = true;
        sdlDrawFont(255, 255, 255, (WIDTH/2.5)-170, (HEIGHT/2.5)-100, FONT, 90, "GAMEOVER");
    }
}
开发者ID:bogardt,项目名称:mySnake,代码行数:33,代码来源:SdlDisplay.cpp

示例3: switch

void GameScene::onTouchEnded(Touch* touch, Event* event)
{
    Point pos = touch->getLocation();
    SimpleGestures rtn = recognizer->endPoint(pos);
    switch (rtn) {
        case SimpleGesturesLeft:
            doLeft();
            doCheck();
            setScore(score);
            break;
        case SimpleGesturesRight:
            doRight();
            doCheck();
            setScore(score);
            break;
        case SimpleGesturesUp:
            doUp();
            doCheck();
            setScore(score);
            break; 
        case SimpleGesturesDown:
            doDown();
            doCheck();
            setScore(score);
            break;
        case SimpleGesturesNotSupport:
        case SimpleGesturesError:
            log("not support or error touch,use geometricRecognizer!!");
            break;
        default:
            break; 
    } 
} 
开发者ID:hkb1990,项目名称:PracticeHand,代码行数:33,代码来源:GameScene.cpp

示例4: setScore

void EnemyLayer::blowupEnemy(EnemySprite* pEnemySprite) {
	Animation *pAnimation = NULL;
	Sprite *pmsprite = NULL;
	char *buff = NULL;
	if (Enemy1 == pEnemySprite->getTag()) {
		buff = "a_001.png";
		pAnimation = AnimationCache::getInstance()->getAnimation("Enemy1Blowup");
		setScore(ENEMY1_SCORE);
	} else if (Enemy2 == pEnemySprite->getTag()) {
		buff = "b_001.png";
		pAnimation = AnimationCache::getInstance()->getAnimation("Enemy2Blowup");
		setScore(ENEMY2_SCORE);
	} else if (Enemy3 == pEnemySprite->getTag()) {
		buff = "d_00001.png";
		pAnimation = AnimationCache::getInstance()->getAnimation("Enemy3Blowup");
		setScore(ENEMY3_SCORE);
	} else {
		return;
	}
	pmsprite = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(buff));

	Point newPos = pEnemySprite->getcurPoint();
	Animate *pAnimate = Animate::create(pAnimation);
	pmsprite->setPosition(newPos);
	this->addChild(pmsprite);

	CallFuncN* mactiondone = CallFuncN::create(CC_CALLBACK_0(EnemyLayer::f_removemyAnimation, this, pmsprite));
	auto seq = Sequence::create(pAnimate, mactiondone, NULL);
	pmsprite->runAction(seq);
	removeEnemy(pEnemySprite);
	updateScore(m_score);
}
开发者ID:ljdzxx,项目名称:hello-world,代码行数:32,代码来源:EnemyLayer.cpp

示例5: outfile

void		SdlDisplay::sdlSetHighscore(const char *file, bool multi)
{
    std::ofstream outfile(file, std::ios_base::out | std::ios_base::app);

    if (multi)
        if (!score && !p2score)
            return;
        else
            outfile << setScore(score, "P1") << setScore(p2score, "P2");
    else if (!score && !p2score)
        return;
    else
        outfile << setScore(score, "P1");
    outfile.close();
}
开发者ID:bogardt,项目名称:mySnake,代码行数:15,代码来源:SdlDisplay.cpp

示例6: getItemType

void GameNewLinker::getScoreByStar() {
    std::vector<int>animalUnLink;
    //未连接的图像数组
    for (int i = 0; i < AnimalList.size(); i++) {
        if (AnimalList[i] -> getLinkStatus()) {
            bool wellPush = true;
            for (int j = 0; j < animalUnLink.size(); j++) {
                if (animalUnLink[j] == AnimalList[i] -> getItemType()) {
                    wellPush = false;
                }
            }
            if (wellPush) {
                animalUnLink.push_back(AnimalList[i] -> getItemType());
            }
        }
    }
    for (int i = 0; i < animalUnLink.size(); i++) {
        batter++;
        if (batter > bigestBatter) {
            bigestBatter = batter;
        }
        allbatter ++;
        if (animalUnLink[i] == Box_5w) {
            score += 50000;
            setScore((long)score);
        }
        setScore_link();
    }
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:29,代码来源:GameNewLinker.cpp

示例7: setScore

void GameNewLinker::setScore_link() {
    int link_score = 50 * batter;
    int points_score = pointsCount * 100 + 100;
    int allscore = (link_score + points_score) * gameBatterType;
    score += allscore;
    setScore((long)score);
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:7,代码来源:GameNewLinker.cpp

示例8: QWidget

PlayPanel::PlayPanel(QWidget* parent)
   : QWidget(parent, Qt::Dialog)
      {
      cachedTickPosition = -1;
      cachedTimePosition = -1;
      cs                 = 0;
      setupUi(this);
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

      QSettings settings;
      restoreGeometry(settings.value("playPanel/geometry").toByteArray());
      move(settings.value("playPanel/pos", QPoint(DEFAULT_POS_X, DEFAULT_POS_Y)).toPoint());

      setScore(0);
      playButton->setDefaultAction(getAction("play"));
      rewindButton->setDefaultAction(getAction("rewind"));
      metronomeButton->setDefaultAction(getAction("metronome"));
      loopButton->setDefaultAction(getAction("loop"));
      loopInButton->setDefaultAction(getAction("loop-in"));
      loopOutButton->setDefaultAction(getAction("loop-out"));

      connect(volumeSlider, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double,int)));
      connect(posSlider,    SIGNAL(sliderMoved(int)),         SLOT(setPos(int)));
      connect(tempoSlider,  SIGNAL(valueChanged(double,int)), SLOT(relTempoChanged(double,int)));
      connect(seq,          SIGNAL(heartBeat(int,int,int)),   SLOT(heartBeat(int,int,int)));
      }
开发者ID:CFrei,项目名称:MuseScore,代码行数:26,代码来源:playpanel.cpp

示例9: addChild

void PlayLayer::explodeSushi(SushiSprite *sushi)
{
	//log("explodeSushi ture");
    float time = 0.3;
    
    // 1. action for sushi
    sushi->runAction(Sequence::create(
                                      ScaleTo::create(time, 0.0),
                                      CallFunc::create(CC_CALLBACK_0(Sprite::removeFromParent, sushi)),
                                      NULL));
	
    // 2. action for circle
    auto circleSprite = Sprite::create("circle.png");
	addChild(circleSprite, 10);
	circleSprite->setPosition(sushi->getPosition());
	circleSprite->setScale(0);// start size
    circleSprite->runAction(Sequence::create(ScaleTo::create(time, 1.0),
                                             CallFunc::create(CC_CALLBACK_0(Sprite::removeFromParent, circleSprite)),
                                             NULL));

    // 3. particle effect
	auto particleStars = ParticleSystemQuad::create("stars.plist");
    particleStars->setAutoRemoveOnFinish(true);
	particleStars->setBlendAdditive(false);
	particleStars->setPosition(sushi->getPosition());
	particleStars->setScale(0.3);
    addChild(particleStars, 20);

	//消除加分
	setScore();
}
开发者ID:chessgit,项目名称:SushiGame-Classes,代码行数:31,代码来源:PlayLayer.cpp

示例10: TextItem

Score::Score()
    : TextItem((BRICK_WIDTH * WIDTH)/6, qRound(BRICK_HEIGHT * 1.5))
{
    moveTo(0, - (height * 1.2));
    
    setScore(0);
}
开发者ID:jsj2008,项目名称:kdegames,代码行数:7,代码来源:textitems.cpp

示例11: update

void PlayScene::update(float delta)
{
    counter += 1;
    if (counter == 14) {
        counter = 0;
        jumped = false;
    }
    if (counter % 2 == 1) {
        characterLayer->enterFrame(counter / 2);
    }
    if ((!jumped && counter == 12 && postkun->isJump)
            || (!jumped && counter == 13 && postkun->isJump)) {
        jumped = true;
        score++;
        auto str = StringUtils::format("score:%d", score);
        scoreLabel->setString(str);
    }

    if (!jumped && counter == 13) {
        // over
        auto scene = GameOverScene::createScene();
        auto over = (GameOverScene*)scene->getChildByName("GameOverLayer");
        over->setScore(score);
        Director::getInstance()->replaceScene(scene);
    }
}
开发者ID:tamurashingo,项目名称:postkun_android,代码行数:26,代码来源:PlayScene.cpp

示例12: destory

void Enemy::destory( )
{

	if(hp <= 0){

		//explosion effect  flame
		auto effect = Effect::CreateEffect( );
		effect->explosion(gameStage, this->getPosition( ));

		//explosion effect of particle


		auto config = Config::getInstance( );
		if(config->geteffectState( ))
		{
			SimpleAudioEngine::getInstance( )->playEffect( ship_explode_effect0 );
		}
	
		config->setScore( config->getScore( ) + score );

		//log("current get score is :%d",config->getScore  () );
	
		this->unschedule(schedule_selector( Enemy::fire ) );
		this->removeFromParent( );
	}
}
开发者ID:chenleijava,项目名称:bonefly1.0,代码行数:26,代码来源:Enemy.cpp

示例13: init

void HumanConsole::restart() {
    timeCount = 0;
    lastMove = 0;
    lastSpeedup = -1000;
    running = false;

    keyUp = keyDown = keyLeft = keyRight = false;
    keyShift = keyZ = keyX = false;

    gameInfo.gameStatus = INIT;
    gameInfo.score = gameInfo.round = 0;
    gameInfo.planeX = PLANE_INIT_X;
    gameInfo.planeY = PLANE_INIT_Y;
    gameInfo.planeSkillsNum = 0;

    string bossName;
    init(bossName);
    emit setBossName(QString(bossName.c_str()));
    emit setPlayerName(QString("Human"));
    emit setTime(0);
    emit setScore(0);
    emit setValue1(0);
    emit setValue2(0);

    gameCenter->init(QPointF(gameInfo.planeX, gameInfo.planeY), QPointF(BULLET_X, BULLET_Y));
}
开发者ID:chnlkw,项目名称:16thAI9,代码行数:26,代码来源:humanconsole.cpp

示例14: setScore

void GameLayer::restart() {
    
    setScore(0);
    resetCollisions();
    resetRole();
    beginCountdown(3);
}
开发者ID:DoubleHH,项目名称:FlappyBird,代码行数:7,代码来源:GameLayer.cpp

示例15: QObject

Cursor::Cursor(Score* s)
   : QObject(0)
      {
      _track   = 0;
      _segment = 0;
      setScore(s);
      }
开发者ID:WeiChou,项目名称:MuseScore,代码行数:7,代码来源:cursor.cpp


注:本文中的setScore函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。