遇到一个奇怪的问题,是用windows开发,部署在安卓机器上,按照如下步骤:
1、在屏幕上创建一个PhysicsBody,代码非常简单(具体见附件)。
// 创建物理世界
auto scene = Scene::createWithPhysics();
scene->getPhysicsWorld()->setDebugDrawMask(cocos2d::PhysicsWorld::DEBUGDRAW_ALL);
…
// 创建物理边界
auto contentSize = this->getContentSize();
auto edge = Node::create();
edge->setPhysicsBody(PhysicsBody::createEdgeBox(contentSize));
edge->setPosition(contentSize.width / 2, contentSize.height / 2);
this->addChild(edge);
// 创建一个PhysicalBody
auto role = cocos2d::Sprite::create(“block.png”);
auto roleSize = role->getBoundingBox().size;
role->setPosition(contentSize.width / 2, roleSize.height / 2);
role->setPhysicsBody(PhysicsBody::createBox(roleSize));
this->addChild(role);、
2、打包成apk(见附件)。
3、在安卓机器上运行
4、不要退出程序,按机器的HOME切换,之后再进入一次程序,此时PhysicalBody会莫名其妙地弹起来。
cocos2d-x版本v3.0beta2,在三星note2和小米3都会有同样的问题。
哪位大神可以解决一下?