有些时候感受,坑多多。 可是如今一一突破了,真不容易。如今要真的写皮肤了和音乐了,要否则,用官方网站的皮肤,根本就是给人以幼儿园的感受。 web
根据瓦片地图的属性,是肯定 敌人类的属性。 如今我作到的是,瓦片地图的对象图层,中去建立不少属性,而后读写出来放在一个实体类里。而后再把实体类加载到 敌人类里。 而后敌人类会根据不一样的属性,发挥不一样的特性。svg
//PropertyData 实体类
//EnemyRole 是一个继承了Sprite的类
bool EnemyRole::init(PropertyData *property, b2Body *body, std::string str){
// auto spriteA = Sprite::create("BoxA2.png");
propertyData=property;
this->body=body;
this->setAnchorPoint(ccp(0.5,0.5));
this->setTexture(property->getImage());
this->setTag(property->getID());
b2PolygonShape dynamicBox;
dynamicBox.SetAsBox(1,1);
this->setCameraMask((unsigned short) CameraFlag::USER1);
propertyData->setImage(property->getImage());
propertyData->setID(property->getID());
body->SetUserData(this);
int tags = this->getTag();
//根据tags的不一样判断不一样瓦片的特性
if( tags==39){
sprite_title1 = Sprite::create("title.png");
sprite_title1->setScaleX(0.8);
sprite_title1->setScaleY(0.3);
sprite_title1->setAnchorPoint(ccp(0.0,0.0));
sprite_title1->setPosition(this->getPositionX()-40,this->getPositionY()+80);
sprite_title1->setCameraMask((unsigned short)CameraFlag::USER1);
this->addChild(sprite_title1,10);
this->schedule(schedule_selector(EnemyRole::update));
}