<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>picture</key> <array> <string>1.png</string> <string>2.png</string> <string>3.png</string> </array> <key>point</key> <array> <string>{200,300}</string> <string>{500,300}</string> <string>{800,300}</string> </array> </dict> </plist>
////////////////////////////////////////////////////////////////////////// //SmallTools2 CCDictionary* plistDic = CCDictionary::createWithContentsOfFile("SmallTools2.plist"); CCArray* picture_array = (CCArray*)plistDic->objectForKey("picture"); CCArray* point_array = (CCArray*)plistDic->objectForKey("point"); for (int i=0;i<picture_array->count();i++) { CCString* pi_string = (CCString*)picture_array->objectAtIndex(i); CCSprite* sprite = CCSprite::create(pi_string->getCString()); CCString* point_string = (CCString*)point_array->objectAtIndex(i); CCPoint point = CCPointFromString(point_string->getCString()); sprite->setPosition(ccp(point.x,point.y)); this->addChild(sprite,1,++TagCount); } //////////////////////////////////////////////////////////////////////////
作者:Nat_myron 发表于2013-3-30 13:45:42 原文链接
阅读:0 评论:0 查看评论