标签:style blog http color ar os sp for on
我在上一节中介绍了开始功能的实现,在这篇博客中将介绍新局功能的实现
首先看一下效果图
通过观察上图的实现效果可知新局的实现思路
1、隐藏选择框
2、隐藏32个棋子
3、初始化32个棋子
首先在SceneGame的init()中添加下面的代码用于创建选择框
//创建一个选择框
    //当选中某个棋子的时候,选择框会套在选好的棋子上
    _selectSprite = CCSprite::create("selected.png");
    addChild(_selectSprite);
    //隐藏选择框
    _selectSprite->setVisible(false);
    //设置选择框的优先级
    _selectSprite->setZOrder(1000);
    //压缩选择框
    _selectSprite->setScale(.8f);在SceneGame中创建一个成员函数New()用于实现新局,New()中的代码
//实现新局
void SceneGame::New(CCObject* obj)
{
    //隐藏选择框
    _selectSprite->setVisible(false);
     for(int i=0; i<32; i++)
    {
      //隐藏32个棋子
      _s[i]->setVisible(false); 
    }
    //初始化棋子
    initStone();
}
标签:style blog http color ar os sp for on
原文地址:http://blog.csdn.net/u010105970/article/details/41219795