物体不能正确飞行

时间:2014-09-03 10:20:08

标签: cocos2d-iphone spritebuilder cocos2d-iphone-3

我是cocos2D的新程序员,我尝试做教程https://www.makegameswith.us/tutorials/getting-started-with-spritebuilder/creating-two-levels/ 但我的物体只是飞到地上而不是正确......我不知道是什么错。 这是我的代码:

- (void)launchFire {
    // loads the Penguin.ccb we have set up in Spritebuilder
    CCNode* fireBall = [CCBReader load:@"Fireball"];
    // position the penguin at the bowl of the catapult
    fireBall.position = ccpAdd(_block.position, ccp(18, 50));

    CCLOG(@"Block Position: \nX:%.2f\nY:%.2f",_block.position.x,_block.position.y);
    CCLOG(@"Fireball Position: \nX:%.2f\nY:%.2f",fireBall.position.x,fireBall.position.y);
    // add the penguin to the physicsNode of this scene (because it has physics enabled)
    [_physicsNode addChild:fireBall];

    // manually create & apply a force to launch the penguin
    CGPoint launchDirection = ccp(1, 0);
    CGPoint force = ccpMult(launchDirection, 8000);
    [fireBall.physicsBody applyForce:force];        
}

我使用的是变量火球而不是Pinguin ...... Fireball Physics config

如果你可以帮助我,很多人谢谢。

0 个答案:

没有答案