[英]car moving body in box2d with cocos2d-x
i have car body and 2 tiers as seprate images . 我有车身和2层作为单独的图像。
how to fix as car body(box2d with cocos2d-x) and moving animation.(i need to rotate tier) and jumping etc.,? 如何固定为车身(带有cocos2d-x的box2d)和移动动画。(我需要旋转层)和跳跃等,?
in normal cocos2d-x i can make something like this.. 在普通的cocos2d-x中,我可以做类似的事情。
car = CCSprite::spriteWithFile("car.png");
car->setPosition(ccp(car->getContentSize().width/2+30, car->getContentSize().height-19));
this->addChild(car, 10);
tire = CCSprite::spriteWithFile("tire.png");
tire->setPosition(ccp(tire->getContentSize().width/2+43, tire->getContentSize().height+8));
this->addChild(tire, 10);
tire1 = CCSprite::spriteWithFile("tire.png");
tire1->setPosition(ccp(tire->getContentSize().width/2+136, tire->getContentSize().height+8));
this->addChild(tire1, 10);
CCRotateBy *Rot = CCRotateBy::actionWithDuration (1.0f, 360);
CCRepeatForever *rep = CCRepeatForever::actionWithAction(Rot);
CCRotateBy *Rot1 = CCRotateBy::actionWithDuration(1.0f, 360);
CCRepeatForever *rep1 = CCRepeatForever::actionWithAction(Rot1);
tire->runAction(rep);
tire1->runAction(rep1);
but in box2d how to make? 但是在box2d中如何制作? any example..
任何例子..
for collison detction for all thing planing to use box2d. Collison检测所有打算使用box2d的东西。
cocos2D-x Doc contains an article about Box2D.. http://www.cocos2d-x.org/docs/manual/framework/native/physics/physics-integration/en not that detailed, but good enough to start with. cocos2D-x Doc包含有关Box2D的文章。http://www.cocos2d-x.org/docs/manual/framework/native/physics/physics-physics-integration/不够详细,但足以作为起点。
Also cocos2D-x framework test contains example of both Box2D and Chipmumk physics example. 此外,cocos2D-x框架测试还包含Box2D和Chipmumk物理示例的示例。 http://www.cocos2d-x.org/docs/manual/framework/native/getting-started/v3.0/how-to-run-cpp-tests-on-win32/en
http://www.cocos2d-x.org/docs/manual/framework/native/getting-started/v3.0/how-to-run-cpp-tests-on-win32/en
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.