就是这个例子,应该很简单,主要用到的有:精灵的移动,触摸,碰撞检测。 赶紧搞定,待会还要陪哲哲来几局爱消除。 首先在Scene初始化方法里添加精灵: CCSprite *player =CCSprite::create("Player.png",CCRectMake(0,0,27,40)); player->setPosition(ccp(origin.x+ player->getContentSize().width/2,origin.y+visibleSize.height/2)); this->addChild(player,1); 注意,以前的版本初始化方法叫spriteWithFile 修改Scene背景色 class HelloWorld : public cocos2d::CCLayerColor if ( !CCLayerColor::initWithColor(ccc4(255,255,255,255)) ) 随机在屏幕右侧添加幽灵 void HelloWorld::addTarget() { CCSprite *target=CCSprite::create("Target.png",CCRectMake(0,0,27,40)); CCSize winSize=CCDirector::sharedDirector()->getWinSize(); int