はcocos2dバージョンv1.0.1デベロッパーcocos2d setasedge問題
groundBox.SetAsEdge(left,right);
ではそれはそれは、以前のバージョン で削除されたように理にかなっている方法が存在しないというエラーとしてSetAsEdgeを使用しないする必要がありますしかし、私はボックスを作成しないでこれを行う方法がわかりません。代わりに、複数の線を頂点の配列を使用して作成しています(私の理解から)
- (void)createGroundEdgesWithVerts:(b2Vec2 *)verts numVerts:(int)num
spriteFrameName:(NSString *)spriteFrameName {
CCSprite *ground =
[CCSprite spriteWithSpriteFrameName:spriteFrameName];
ground.position = ccp(groundMaxX+ground.contentSize.width/2,
ground.contentSize.height/2);
[groundSpriteBatchNode addChild:ground];
b2PolygonShape groundShape;
b2FixtureDef groundFixtureDef;
groundFixtureDef.shape = &groundShape;
groundFixtureDef.density = 0.0;
// Define the ground box shape.
b2PolygonShape groundBox;
for(int i = 0; i < num - 1; ++i) {
b2Vec2 offset = b2Vec2(groundMaxX/PTM_RATIO +
ground.contentSize.width/2/PTM_RATIO,
ground.contentSize.height/2/PTM_RATIO);
b2Vec2 left = verts[i] + offset;
b2Vec2 right = verts[i+1] + offset;
groundShape.SetAsEdge(left,right);
groundBody->CreateFixture(&groundFixtureDef);
}
groundMaxX += ground.contentSize.width;
}
あなたはBOX2Dの代わりに、cocos2d –
について話しているあなたはそのための色を設定しない方法もええ技術的にその両方 – Luke