void BonusRound::ccTouchesBegan(CCSet* touches, CCEvent *event) { CCTouch* touch = (CCTouch*)(touches[0].anyObject()); CCPoint location = touch->getLocationInView(); location = CCDirector::sharedDirector()->convertToGL(location); location = convertToNodeSpace(location); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Audio/ThrowRock.wav"); for (unsigned int i = 0 ; i < allCrows->count() ; i++) { CCSprite *crow = (CCSprite*)allCrows->objectAtIndex(i); if (crow->boundingBox().containsPoint(location)) { //crowsToDelete->addObject(crow); crow->stopAllActions(); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Audio/Bonus_Round_Crow_Hit.mp3"); UpdateBonusLabel(); if (crow->getTag() == LEFT_TAG) { crow->runAction(CCRotateBy::create(2, 720)); crow->runAction(CCSequence::createWithTwoActions(CCMoveTo::create(0.5f, ccp(crow->getPosition().x + winSize.width/4 , -10)), CCCallFuncN::create(this, callfuncN_selector(BonusRound::RemoveCrow)))); } else { crow->runAction(CCRotateBy::create(2, -720)); crow->runAction(CCSequence::createWithTwoActions(CCMoveTo::create(0.5f, ccp(crow->getPosition().x - winSize.width/4 , -10)), CCCallFuncN::create(this, callfuncN_selector(BonusRound::RemoveCrow)))); } } } RemoveStone(); totalRocks--; if (totalRocks == 0) { this->setTouchEnabled(false); unschedule(schedule_selector (BonusRound::SpawnCrow)); this->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(1.25f), CCCallFunc::create(this, callfunc_selector(BonusRound::EndRound)))); } }
/* 石を置く */ int CheckPut(int x,int y) { int i,check,remove,koflag; if(x == 0 | y == 0) { return -1; } z = (WIDTH * y) + x; remove = 0; koflag = 1; ClearCheckBoard(); /* コウの処理 */ if(z == ko_z && move == ko_num) { color = FlipColor(color); printf("Ko has occurred.Here is ban position.\n"); return z; } if(z <= ALLBOARD && board[z] == EMPTY) { board[z] = color; } else { color = FlipColor(color); printf("Put error.\n"); return z; } for(i = 0; i < 4; i++) { check = z + dir4[i]; if(board[check] == color) { koflag = 0; } } for(i = 0; i < 4; i++) { check = z + dir4[i]; remove = RemoveStone(check); if(koflag == 1 && remove == 1) { ko_num = (move + 1); for(i = 0; i < 4; i++) { check = z + dir4[i]; if(board[check] == EMPTY) { ko_z = check; } } } if(remove != 0) { if(color == BLACK) { prisoner_b += remove; } else { prisoner_w += remove; } } } board[z] = EMPTY; if(CheckWarning(z) != -1) { board[z] = color; move++; } else { color = FlipColor(color); printf("Put error.\n"); } return z; }