如图,在win10上运行,物体莫名其妙的跳动,有时候直接就飞出屏幕了,但是发布后在手机上运行并没有这个问题,这是什么原因啊?
bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
auto rootNode = CSLoader::createNode("MainScene.csb");
addChild(rootNode);
root =(Layout*) rootNode->getChildByName("root");
auto pan_earth = (Layout*)root->getChildByName("pan_earth");
pan_earth->setPhysicsBody(PhysicsBody::createBox(pan_earth->getContentSize()));
pan_earth->getPhysicsBody()->setDynamic(false);
spr_bird=(Sprite*)root->getChildByName("pan_earth")->getChildByName("spr_bird");
spr_bird->setPhysicsBody(PhysicsBody::createCircle(spr_bird->getContentSize().width / 2,PHYSICSBODY_MATERIAL_DEFAULT,Vec2(0,-10)));
spr_bird->getPhysicsBody()->setVelocity(Vec2(150,150));
Vector<Node*> spr_woods = root->getChildByName("pan_woods")->getChildren();
for each (Sprite* spr_wood in spr_woods)
{
spr_wood->setPhysicsBody(PhysicsBody::createBox(spr_wood->getContentSize()));
}
return true;
}