Cocos2d-x 3.2 大富翁游戏项目开发-第十部分实现人物轮流行走(2)
来源:未知 责任编辑:责任编辑 发表时间:2015-03-01 01:34 点击:次
voidGameBaseScene::goButtonCallback(cocos2d::CCObject *pSender) { ………………………………. //在go点击后,发送go按钮消失信息 NotificationCenter::getInstance()->postNotification(MSG_GO,String::create(0)); player1->startGo(rowVector,colVector); log(go button clicked over); }
voidRicherGameController::pickOnePlayerToGo() { for(auto it=GameBaseScene::players_vector.begin();it!=GameBaseScene::players_vector.end();it++) { RicherPlayer* richerPlayer = dynamic_cast(*it); if(richerPlayer->getIsMyTurn()) { RouteNavigation::getInstance()->getPath(richerPlayer,3,GameBaseScene::canPassGrid,GameBaseScene::tiledRowsCount,GameBaseScene::tiledColsCount); richerPlayer->startGo(RouteNavigation::getInstance()->getPathRow_vector(),RouteNavigation::getInstance()->getPathCols_vector()); return; } } for(auto it=GameBaseScene::players_vector.begin();it!=GameBaseScene::players_vector.end();it++) { RicherPlayer* richerPlayer = dynamic_cast (*it); richerPlayer->setIsMyTurn(true); } //代码运行到这里,代表都走完了,发送一个显示go按钮的信息 NotificationCenter::getInstance()->postNotification(MSG_GO,String::create(1)); }
做完这些之后,还做了一下扫尾工作,把人物的资金和体力显示出来,并让人物获取随机步数,然后行走。简单就不解释了。
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>