1.精灵的创建
//精灵的创建¨
CCSprite* player = CCSprite::create("xx.png");
player->setPosition(ccp(x,y));
this->addChild(player);
2.图片菜单的创建
//菜单的使用
CCMenuItemImage* item = CCMenuItemImage::create("5.png",
"6.png",
"7.png",
this,
menu_selector(function));//监听函数
item->setPosition(ccp(x,y));
//将图片菜单添加到menu组件上
CCMenu* menu = CCMenu::create(item,NULL);
this->addChild(menu);
3.初始化Tield地图
void HelloWorld::initMap()
{
map=CCTMXTiledMap::create("1.tmx");
this->addChild(map);
}
4.拼接字符串与整数型
char aa[100] = {0};
sprintf(aa,"f%i.png",2);
5.移动精灵
CCMoveTo* move = CCMoveTo::create(2,ccp(0,y2));
Sprite->runAction(move)