本文整理汇总了C++中CCSpriteBatchNode::getChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSpriteBatchNode::getChildByTag方法的具体用法?C++ CCSpriteBatchNode::getChildByTag怎么用?C++ CCSpriteBatchNode::getChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSpriteBatchNode
的用法示例。
在下文中一共展示了CCSpriteBatchNode::getChildByTag方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetMapNode
void GameLayer::resetMapNode(CCNode *node)
{
// window size
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCLOG("winSize %f %f random %f %f", winSize.width, winSize.height, CCRANDOM_0_1(), CCRANDOM_MINUS1_1());
// get batchnode
CCSpriteBatchNode *batchNode = (CCSpriteBatchNode *)node->getChildByTag(MapBatchNodeTag);
// reset monster position
float positionX = kGameMapFirstRoad + (rand()%3) * kGameMapRoadSpace;
CCSprite *monsterSprite = (CCSprite *)batchNode->getChildByTag(MapMonsterTag);
monsterSprite->setPosition(ccp(positionX, CCRANDOM_0_1() * winSize.height));
// reset river position
CCSprite *riverSprite = (CCSprite *)batchNode->getChildByTag(MapRiverTag);
float iptr = winSize.height;
float positionY = modff((CCRANDOM_0_1() * 100 + 50 + monsterSprite->getPosition().y), &iptr);
riverSprite->setPosition(ccp(winSize.width/2.f, positionY));
// reset coins position
positionX = kGameMapFirstRoad + (rand()%3) * kGameMapRoadSpace;
float startPositionY = CCRANDOM_0_1() * winSize.height;
for (int i = 0; i < kGameCoinCount; i ++) {
CCSprite *coinSprite = (CCSprite *)batchNode->getChildByTag(MapCoinStartTag + i);
iptr = winSize.height;
positionY = modff(startPositionY + 60 * i, &iptr);
coinSprite->setPosition(ccp(positionX, positionY));
coinSprite->setVisible(true);
}
}
示例2: _resetPlatform
void GameLayer::_resetPlatform()
{
if(platformCount >= K_MAX_PLATFORMS_IN_GAME) {
isGameOver = true;
}
if(currentPlatformY < 0)
currentPlatformY = 30.0f;
else
{
currentPlatformY += CCRANDOM_0_1() * (int)(currentMaxPlatformStep - K_MIN_PLATFORM_STEP) + K_MIN_PLATFORM_STEP;
if(currentMaxPlatformStep < K_MAX_PLATFORM_STEP)
currentMaxPlatformStep += 0.5f;
}
CCSpriteBatchNode* batchNode = dynamic_cast<CCSpriteBatchNode*>(getChildByTag(kSpriteManager));
CCSprite* platform = dynamic_cast<CCSprite*>(batchNode->getChildByTag(currentPlatformTag));
if(CCRANDOM_0_1() * 2 == 1)
platform->setScaleX(-1.0f);
float x;
CCSize size = platform->getContentSize();
if(currentPlatformY == 30.0f)
x = SCREEN_WIDTH * 0.5f;
else
x = CCRANDOM_0_1() * (SCREEN_WIDTH - (int) size.width) + size.width * 0.5f;
platform->setPosition(ccp(x, currentPlatformY));
platformCount++;
if(platformCount == currentBonusPlatformIndex && platformCount != K_MAX_PLATFORMS_IN_GAME)
{
CCSprite* bonus = dynamic_cast<CCSprite*>(batchNode->getChildByTag(kBonusStartTag + currentBonusType));
bonus->setPosition(ccp(x, currentPlatformY + 30));
bonus->setVisible(true);
}
// TODO: If the platform count reaches K_MAX_PLATFORMS, Add the "Exit" icon onto the platform.
if (platformCount == K_MAX_PLATFORMS_IN_GAME)
{
// Add the "Exit" icon onto the platform.
CCSprite* exit = dynamic_cast<CCSprite*>(getChildByTag(kExit));
exit->setPosition(ccp(x, currentPlatformY + 48));
exit->setVisible(true);
}
}
示例3: resetBarrierNode
void GameLayer::resetBarrierNode(CCNode *node, int nodeTag)
{
// window size
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
// get batchnode
CCSpriteBatchNode *batchNode = (CCSpriteBatchNode *)node->getChildByTag(MapBatchNodeTag);
CCNode *mapNode = this->getChildByTag(nodeTag - MapBarrierStartTag + MapStartTag);
CCSpriteBatchNode *mapBatchNode = (CCSpriteBatchNode *)mapNode->getChildByTag(MapBatchNodeTag);
CCSprite *riverSprite = (CCSprite *)mapBatchNode->getChildByTag(MapRiverTag);
// reset barrier position
CCSprite *barrierSprite = (CCSprite *)batchNode->getChildByTag(MapBarrierTag);
float iptr = winSize.height;
float positionY = modff((CCRANDOM_0_1() * 100 + 50 + riverSprite->getPosition().y), &iptr);
barrierSprite->setPosition(ccp(winSize.width/2.f, positionY));
}
示例4: _resetBonus
void GameLayer::_resetBonus()
{
CCSpriteBatchNode* batchNode = dynamic_cast<CCSpriteBatchNode*>(getChildByTag(kSpriteManager));
CCSprite* bonus = dynamic_cast<CCSprite*>(batchNode->getChildByTag(kBonusStartTag + currentBonusType));
bonus->setVisible(false);
currentBonusPlatformIndex += CCRANDOM_0_1() * (K_MAX_BONUS_STEP - K_MIN_BONUS_STEP) + K_MIN_BONUS_STEP;
if(score < 10000)
currentBonusType = 0;
else if(score < 50000)
currentBonusType = CCRANDOM_0_1() * 2;
else if(score < 100000)
currentBonusType = CCRANDOM_0_1() * 3;
else
currentBonusType = CCRANDOM_0_1() * 2 + 2;
}
示例5: _resetBird
// bird logic
void GameLayer::_resetBird()
{
CCSpriteBatchNode* batchNode = dynamic_cast<CCSpriteBatchNode*>(getChildByTag(kSpriteManager));
CCSprite* bird = dynamic_cast<CCSprite*>(batchNode->getChildByTag(kBird));
bird_position.x = SCREEN_WIDTH * 0.5f;
bird_position.y = SCREEN_WIDTH * 0.5f;
bird->setPosition(bird_position);
bird_velocity.x = 0;
bird_velocity.y = 0;
bird_acceleration.x = 0;
bird_acceleration.y = -550.0f;
birdLookingRight = true;
bird->setScaleX(1.0f);
}
示例6: update
void GameLayer::update(float dt)
{
if(gameSuspended)
return;
// MainLayer shows the background with clouds that does just scrolls but does not interact
MainLayer::update(dt);
CCSpriteBatchNode* batchNode = dynamic_cast<CCSpriteBatchNode*>(getChildByTag(kSpriteManager));
CCSprite* bird = dynamic_cast<CCSprite*>(batchNode->getChildByTag(kBird));
bird_position.x += bird_velocity.x * dt;
// birdLookingRight/Left is used to flip the bird in the right direction i.e. direction of the velocity
// so the bird does not travel backwards
if(bird_velocity.x < -30.0f && birdLookingRight)
{
birdLookingRight = false;
// what is the point of setting scaleX?
bird->setScaleX(-1.0f);
}
else if(bird_velocity.x > 30.0f && !birdLookingRight)
{
birdLookingRight = true;
bird->setScaleX(1.0f);
}
CCSize bird_size = bird->getContentSize();
float max_x = SCREEN_WIDTH + bird_size.width * 0.5f;
float min_x = -bird_size.width * 0.5f;
if(bird_position.x > max_x)
bird_position.x = min_x;
if(bird_position.x < min_x)
bird_position.x = max_x;
bird_velocity.y += bird_acceleration.y * dt;
bird_position.y += bird_velocity.y * dt;
// TODO: (fix this hack) - just set it so that every 20 frames, we decrease the percentage by 1
// when the percentage goes below zero, the healthbar is finished and finish the game
// We should show some animation that the health is over.
fuelInTank--;
if (fuelInTank%20 == 0)
{
pHealthBar->setPercentage(pHealthBar->getPercentage()-1.0);
if (pHealthBar->getPercentage() <= 0)
{
_showHighScores();
}
}
CCSprite* bonus = dynamic_cast<CCSprite*>(batchNode->getChildByTag(kBonusStartTag + currentBonusType));
// check if the bonus node is visible
if(bonus->isVisible())
{
// check if the bird and the bonus are colliding, if so, give the bird the bonus
CCPoint bonus_position = bonus->getPosition();
float range = 20.0f;
if(bird_position.x > bonus_position.x - range &&
bird_position.x < bonus_position.x + range &&
bird_position.y > bonus_position.y - range &&
bird_position.y < bonus_position.y + range)
{
// TODO: Our bonuses should be more rocket fuel or additional lives
switch(currentBonusType)
{
case kBonus5:
score += 5000;
break;
case kBonus10:
score += 10000;
break;
case kBonus50:
score += 50000;
break;
case kBonus100:
score += 100000;
break;
}
CCString* scoreStr = CCString::createWithFormat("%d", score);
CCLabelBMFont* scoreLabel = dynamic_cast<CCLabelBMFont*>(getChildByTag(kScoreLabel));
scoreLabel->setString(scoreStr->getCString());
CCScaleTo* action1 = CCScaleTo::create(0.2f, 1.5f, 0.8f);
CCScaleTo* action2 = CCScaleTo::create(0.2f, 1.0f, 1.0f);
// What are CCScaleTo and CCSequence.. what do these actions do?
// Likely, this just makes the bird move up very fast without it having to collide with anything
CCSequence* action3 = CCSequence::create(action1, action2, action1, action2, action1, action2, NULL);
scoreLabel->runAction(action3);
// what does resetBonus do?
_resetBonus();
//.........这里部分代码省略.........
示例7: update
void GameLayer::update(float dt)
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCSprite *playerSprite = (CCSprite *)this->getChildByTag(PlayerTag);
CCPoint currentPos = playerSprite->getPosition();
// update run distance
runDistance += (currentPos.y - prevPos.y);
// stay the player at specified position
if (currentPos.y > kPlayerStayAtScreenPosY) {
CCPoint newPos = ccp(currentPos.x, kPlayerStayAtScreenPosY);
CCPoint diff = ccpSub(newPos, currentPos);
// move the player and map
playerSprite->setPosition(newPos);
// move map nodes
for (int i = 0; i < kGameMapCount; i ++) {
CCNode *mapNode = this->getChildByTag(MapStartTag + i);
CCPoint mapPos = ccpAdd(mapNode->getPosition(), diff);
mapNode->setPosition(mapPos);
// if map get out of scene
if (mapPos.y <= -winSize.height) {
mapPos = ccp(mapPos.x, (kGameMapCount - 1) * winSize.height);
mapNode->setPosition(mapPos);
this->resetMapNode(mapNode);
}
}
// move map barrier node
for (int i = 0; i < kGameMapCount; i ++) {
CCNode *barrierNode = this->getChildByTag(MapBarrierStartTag + i);
CCPoint barrierPos = ccpAdd(barrierNode->getPosition(), diff);
barrierNode->setPosition(barrierPos);
// if map get out of scene
if (barrierPos.y <= -winSize.height) {
barrierPos = ccp(barrierPos.x, (kGameMapCount - 1) * winSize.height);
barrierNode->setPosition(barrierPos);
this->resetBarrierNode(barrierNode, MapBarrierStartTag + i);
}
}
}
// save current pos
prevPos = playerSprite->getPosition();
// collision detection
for (int i = 0; i < kGameMapCount; i ++) {
CCNode *mapNode = this->getChildByTag(MapStartTag + i);
CCSpriteBatchNode *batchNode = (CCSpriteBatchNode *)mapNode->getChildByTag(MapBatchNodeTag);
CCPoint playerPos = batchNode->convertToNodeSpace(this->convertToWorldSpace(playerSprite->getPosition()));
CCRect playerBox = CCRect(-playerSprite->getContentSize().width/2.0f + playerPos.x, -playerSprite->getContentSize().height/2.0f + playerPos.y, playerSprite->getContentSize().width, playerSprite->getContentSize().height);
CCSprite *monsterSprite = (CCSprite *)batchNode->getChildByTag(MapMonsterTag);
if (playerBox.intersectsRect(monsterSprite->boundingBox())) {
// game over
this->gameOver();
}
CCSprite *riverSprite = (CCSprite *)batchNode->getChildByTag(MapRiverTag);
if (playerBox.intersectsRect(riverSprite->boundingBox())) {
// not in jumpping
if (!isJumpping) {
// game over
this->gameOver();
}
}
for (int i = 0; i < kGameCoinCount; i ++) {
CCSprite *coinSprite = (CCSprite *)batchNode->getChildByTag(MapCoinStartTag + i);
if (playerBox.intersectsRect(coinSprite->boundingBox())) {
coinSprite->setVisible(false);
coinCount ++;
}
}
}
for (int i = 0; i < kGameMapCount; i ++) {
CCNode *barrierNode = this->getChildByTag(MapBarrierStartTag + i);
CCSpriteBatchNode *batchNode = (CCSpriteBatchNode *)barrierNode->getChildByTag(MapBatchNodeTag);
CCPoint playerPos = batchNode->convertToNodeSpace(this->convertToWorldSpace(playerSprite->getPosition()));
CCRect playerBox = CCRect(-playerSprite->getContentSize().width/2.0f + playerPos.x, -playerSprite->getContentSize().height/2.0f + playerPos.y, playerSprite->getContentSize().width, playerSprite->getContentSize().height);
CCSprite *barrierSprite = (CCSprite *)batchNode->getChildByTag(MapBarrierTag);
if (playerBox.intersectsRect(barrierSprite->boundingBox())) {
if (!isSliding) {
// game over
this->gameOver();
}
}
}
// update score label
CCLabelTTF *scoreLabel = (CCLabelTTF *)this->getChildByTag(ScoreLabelTag);
int totalScore = runDistance + coinCount;
scoreLabel->setString(CCString::createWithFormat("score: %d", totalScore)->getCString());
}
示例8: avgGame
void StoryWorld::avgGame(void) {
CCLabelTTF* myDialog = (CCLabelTTF *)getChildByTag(100);
CCLabelTTF* myName = (CCLabelTTF *)getChildByTag(101);
CCSpriteBatchNode *spriteBatch = (CCSpriteBatchNode *)getChildByTag(102);
CCSprite *myLeftSprite = (CCSprite *)spriteBatch->getChildByTag(1);
CCSprite *myRightSprite = (CCSprite *)spriteBatch->getChildByTag(2);
strcpy(dialog, reader.GetNextDialog().c_str());
char theName[10][11]={"","穆婧:", "子轩:", "少杰:", "建国", "路人A:", "路人B:", "路人C:", "老爷爷:", "江姐:"};
myName->setString(theName[dialog[0]-48]);
characterPasterSwitchCase(dialog[0]);
switch (dialog[2]) {
case '1': {
setTouchEnabled(false);
CCSprite *back = CCSprite::create(LANDSCAPE_IMG_PATH);
back->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/2));
back->setOpacity(150);
back->setTag(3);
addChild(back, 3);
switch (current) {
case '3': {
CCLabelTTF *Label1 = CCLabelTTF::create("Yes", "Heiti SC", 40);
CCLabelTTF *Label2 = CCLabelTTF::create("No", "Heiti SC", 40);
CCMenuItemLabel *firstChoice = CCMenuItemLabel::create(Label1, this, menu_selector(StoryWorld::leafletChoiceHandler));
CCMenuItemLabel *secondChoice = CCMenuItemLabel::create(Label2, this, menu_selector(StoryWorld::leafletChoiceHandler));
firstChoice->setTag(fChoice);
secondChoice->setTag(sChoice);
firstChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 4.1));
secondChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 2.9));
CCMenu *menu = CCMenu::create(firstChoice, secondChoice, NULL);
menu->setPosition(CCPointZero);
menu->setTag(2);
addChild(menu, 3);
return;
}
break;
case '9': {
CCLabelTTF *Label1 = CCLabelTTF::create("子轩", "Heiti SC", 40);
CCLabelTTF *Label2 = CCLabelTTF::create("少杰", "Heiti SC", 40);
CCLabelTTF *Label3 = CCLabelTTF::create("建国", "Heiti SC", 40);
CCMenuItemLabel *firstChoice = CCMenuItemLabel::create(Label1, this, menu_selector(StoryWorld::theFinalChoiceHandler));
CCMenuItemLabel *secondChoice = CCMenuItemLabel::create(Label2, this, menu_selector(StoryWorld::theFinalChoiceHandler));
CCMenuItemLabel *thirdChoice = CCMenuItemLabel::create(Label3, this, menu_selector(StoryWorld::theFinalChoiceHandler));
firstChoice->setTag(fChoice);
secondChoice->setTag(sChoice);
thirdChoice->setTag(tChoice);
firstChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 4.1));
secondChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 2.9));
thirdChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 1.8));
CCMenu *menu = CCMenu::create(firstChoice, secondChoice, thirdChoice, NULL);
menu->setPosition(CCPointZero);
menu->setTag(2);
addChild(menu, 3);
return;
}
break;
default:
break;
}
}
break;
case '2': {
}
break;
case '3': {
if (myLeftSprite->getOpacity() == 0)
myLeftSprite->setOpacity(255);
else
myLeftSprite->runAction(CCFadeOut::create(1));
}
break;
case '4': {
if (myRightSprite->getOpacity() == 0)
myRightSprite->setOpacity(255);
else
myRightSprite->runAction(CCFadeOut::create(1));
}
break;
case '5': {
if (myRightSprite->getOpacity()==0 && myLeftSprite->getOpacity()==0) {
myLeftSprite->setOpacity(255);
myRightSprite->setOpacity(255);
} else if (myRightSprite->getOpacity()!=0 && myLeftSprite->getOpacity()!=0) {
myLeftSprite->runAction(CCFadeOut::create(1));
myRightSprite->runAction(CCFadeOut::create(1));
}
}
break;
default:
break;
}
specialPartSwitchCase(dialog[3]);
//.........这里部分代码省略.........
示例9: characterPasterSwitchCase
void StoryWorld::characterPasterSwitchCase(int code) {
CCSpriteBatchNode *spriteBatch = (CCSpriteBatchNode *)getChildByTag(102);
CCSprite *myLeftSprite = (CCSprite *)spriteBatch->getChildByTag(1);
CCSprite *myRightSprite = (CCSprite *)spriteBatch->getChildByTag(2);
switch (dialog[0]) {
case '0': { //无人
char b[10]="me_ .png";
b[3] = dialog[1]+1;
myLeftSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '1': { //ME
char b[10]="me_ .png";
b[3] = dialog[1]+1;
myLeftSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '2': { //子轩
char b[10]="zx_ .png";
b[3] = dialog[1]+1;
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '3': { //少杰
char b[10]="sj_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '4': { //建国
char b[10]="jg_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '5': {
char b[10]="la_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '6': {
char b[10]="lb_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '7': {
char b[10]="lc_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '8': {
char b[10]="yy_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '9': {
char b[10]="jj_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
default:
break;
}
}
示例10: avgGame
void StoryWorld::avgGame(void) {
CCLabelTTF* myDialog = (CCLabelTTF *)getChildByTag(100);
CCLabelTTF* myName = (CCLabelTTF *)getChildByTag(101);
CCSpriteBatchNode *spriteBatch = (CCSpriteBatchNode *)getChildByTag(102);
CCSprite *myLeftSprite = (CCSprite *)spriteBatch->getChildByTag(1);
CCSprite *myRightSprite = (CCSprite *)spriteBatch->getChildByTag(2);
strcpy(dialog, reader.GetNextDialog().c_str());
char theName[10][11]={"","穆婧1:", "子轩:", "少杰:", "建国", "路人A:", "路人B:", "路人C:", "老爷爷:", "江姐:"};
myName->setString(theName[dialog[0]-48]);
//任务立绘切换
switch (dialog[0]) {
case '0': { //无人
char b[10]="me_ .png";
b[3] = dialog[1]+1;
myLeftSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '1': { //ME
char b[10]="me_ .png";
b[3] = dialog[1]+1;
myLeftSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '2': { //子轩
char b[10]="zx_ .png";
b[3] = dialog[1]+1;
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '3': { //少杰
char b[10]="sj_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '4': { //建国
char b[10]="jg_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '5': {
char b[10]="la_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '6': {
char b[10]="lb_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '7': {
char b[10]="lc_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '8': {
char b[10]="yy_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
case '9': {
char b[10]="jj_ .png";
b[3] = dialog[1];
myRightSprite->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(b));
}
break;
default:
break;
}
switch (dialog[2]) {
// 选择走向
case '1': {
//开始选择走向
//停止触摸
setTouchEnabled(false);
CCSprite *back = CCSprite::create(LANDSCAPE_IMG_PATH);
back->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/2));
back->setOpacity(150);
back->setTag(3);
addChild(back, 3);
switch (current) {
case '3': {
CCLabelTTF *Label1 = CCLabelTTF::create("Yes", "Heiti SC", 40);
CCLabelTTF *Label2 = CCLabelTTF::create("No", "Heiti SC", 40);
CCMenuItemLabel *firstChoice = CCMenuItemLabel::create(Label1, this, menu_selector(StoryWorld::makeAChoice));
CCMenuItemLabel *secondChoice = CCMenuItemLabel::create(Label2, this, menu_selector(StoryWorld::makeAChoice));
firstChoice->setTag(fChoice);
secondChoice->setTag(sChoice);
firstChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 4.1));
secondChoice->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width/2, CCDirector::sharedDirector()->getVisibleSize().height/5 * 2.9));
CCMenu *menu = CCMenu::create(firstChoice, secondChoice, NULL);
//.........这里部分代码省略.........