0

私は 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];        
}

ピングインじゃなくてヴァリアブルファイアボールを使った… ファイアボールの物理設定

あなたが私を助けることができれば、多くの多くのおかげで。

4

0 に答える 0