本文整理汇总了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;
}
}
示例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");
}
}
示例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;
}
}
示例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);
}
示例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();
}
示例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();
}
}
示例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);
}
示例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)));
}
示例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();
}
示例10: TextItem
Score::Score()
: TextItem((BRICK_WIDTH * WIDTH)/6, qRound(BRICK_HEIGHT * 1.5))
{
moveTo(0, - (height * 1.2));
setScore(0);
}
示例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);
}
}
示例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( );
}
}
示例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));
}
示例14: setScore
void GameLayer::restart() {
setScore(0);
resetCollisions();
resetRole();
beginCountdown(3);
}
示例15: QObject
Cursor::Cursor(Score* s)
: QObject(0)
{
_track = 0;
_segment = 0;
setScore(s);
}