本文整理汇总了C++中MyObject::setProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ MyObject::setProperties方法的具体用法?C++ MyObject::setProperties怎么用?C++ MyObject::setProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyObject
的用法示例。
在下文中一共展示了MyObject::setProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//CCDictionary* dict = NULL;
//CCObject *pObject = NULL;
CCARRAY_FOREACH(pChildrenArray,pObject)
{
dict = (CCDictionary *)pObject;
if(!dict)
break;
const char* key = "name";
CCString* name = (CCString*)dict->objectForKey(key);
if(name->isEqual(CCString::create("fire")))
{
key = "x";
int x = ((CCString*)dict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)dict->objectForKey(key))->intValue();
addFire(ccp(x,y));
}else if(name->isEqual(CCString::create("monster")))
{
key = "x";
int x = ((CCString*)dict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)dict->objectForKey(key))->intValue();
key = "plistname";
CCString* temp = ((CCString*)dict->objectForKey(key));
string* plistname = new string(temp->getCString());
plistname->append(".plist");
string* spritename = new string(temp->getCString());
spritename->append("_%d.png");
MySprite* sprite = MySprite::getInstance(ccp(x,y),plistname->c_str(),spritename->c_str(),m_pMyworld);
key = "enemy";
sprite->setType(((CCString*)dict->objectForKey(key))->isEqual(CCString::create("true")));//设置 敌人
sprite->setTag(m_iMosterSpriteTag);
if (((CCString*)dict->objectForKey(key))->isEqual(CCString::create("true"))){//如果是敌人
m_iResuduoMonsterNum++;
sprite->setCallbackFunc(this,callfunc_selector(GameSceneLayer::gameVictory));
}else{
sprite->setCallbackFunc(this,callfunc_selector(GameSceneLayer::gameFaild));
}
this->addChild(sprite);
delete plistname;
delete spritename;
}else if(name->isEqual(CCString::create("wood")))
{
key = "x";
int x = ((CCString*)dict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)dict->objectForKey(key))->intValue();
key = "sprite_name";
CCString* sprite_name= (CCString*)dict->objectForKey(key);
MyObject* sprite = MyObject::getInstance(ccp(x,y),sprite_name->getCString(),m_pMyworld,MyObject::WOOD);
this->addChild(sprite);
}else if(name->isEqual(CCString::create("iron_v")))
{
key = "x";
int x = ((CCString*)dict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)dict->objectForKey(key))->intValue();
key = "bottom";
int bottom = ((CCString*)dict->objectForKey(key))->intValue();
key = "speed";
int speed = ((CCString*)dict->objectForKey(key))->intValue();
key = "top";
int top = ((CCString*)dict->objectForKey(key))->intValue();
MyObject* sprite = MyObject::getInstance(ccp(x,y),"iron_v.png",m_pMyworld,MyObject::IRON_V);
sprite->setProperties(ccp(0,speed),ccp(top,bottom),ccp(0,0));
this->addChild(sprite);
}else if(name->isEqual(CCString::create("iron_h")))
{
key = "x";
int x = ((CCString*)dict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)dict->objectForKey(key))->intValue();
key = "left";
int left = ((CCString*)dict->objectForKey(key))->intValue();
key = "speed";
int speed = ((CCString*)dict->objectForKey(key))->intValue();
key = "right";
int right = ((CCString*)dict->objectForKey(key))->intValue();
MyObject* sprite = MyObject::getInstance(ccp(x,y),"iron_h.png",m_pMyworld,MyObject::IRON_H);
sprite->setProperties(ccp(speed,0),ccp(0,0),ccp(left,right));
this->addChild(sprite);
}else if(name->isEqual(CCString::create("triangle")))
{
key = "x";
int x = ((CCString*)dict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)dict->objectForKey(key))->intValue();
MyObject* sprite = MyObject::getInstance(ccp(x,y),"triangle.png",m_pMyworld,MyObject::TRIANGLE);
this->addChild(sprite);
}else if(name->isEqual(CCString::create("circle")))
//.........这里部分代码省略.........