I am a new programmer in cocos2D and I tried to do the tutorial https://www.makegameswith.us/tutorials/getting-started-with-spritebuilder/creating-two-levels/ but my Object just fly down on the ground and not right... I don't know what wrong is. here is my Code:
- (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];
}
I used the Variable Fireball and not Pinguin...
If you can help me, many many Thanks.