質問

ユーザーがカードに触れるとゆっくりとひっくり返り、番号が表示されるゲームを開発します。その目的のために、どのCOCOS2D APIを使用できますか?

または、フリップを示すフレームでアニメーションを作成する必要がありますか?

役に立ちましたか?

解決

ビューをひっくり返すためにあなたはこのようにそれをすることができます、

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.6];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myview cache:YES];
[UIView commitAnimations];

アニメーションを行う前に、ラベルを作成し、UIViewのサブビューとして追加します。アニメーションの後に表示したい番号にテキストを設定します。このラベルを移動した後のアニメーションの終わりに、ラベルの隠されたプロパティをNOに設定します。あなたはあなたが望むアニメーションスタイルを達成するでしょう、私は推測します..これが役立つことを願っています....幸せなコーディング... :)

他のヒント

似たようなものを作成できます CCTransitionFlipX. 。しかし、CCSceneの代わりに、カードノード(スプライト)で動作させます。

このクラスの実装(cctransition.m)は次のとおりです。

//
// FlipX Transition
//
@implementation CCTransitionFlipX
-(void) onEnter
{
    [super onEnter];

    CCActionInterval *inA, *outA;
    [inScene_ setVisible: NO];

    float inDeltaZ, inAngleZ;
    float outDeltaZ, outAngleZ;

    if( orientation == kOrientationRightOver ) {
        inDeltaZ = 90;
        inAngleZ = 270;
        outDeltaZ = 90;
        outAngleZ = 0;
    } else {
        inDeltaZ = -90;
        inAngleZ = 90;
        outDeltaZ = -90;
        outAngleZ = 0;
    }

    inA = [CCSequence actions:
           [CCDelayTime actionWithDuration:duration_/2],
           [CCShow action],
           [CCOrbitCamera actionWithDuration: duration_/2 radius: 1 deltaRadius:0 angleZ:inAngleZ deltaAngleZ:inDeltaZ angleX:0 deltaAngleX:0],
           [CCCallFunc actionWithTarget:self selector:@selector(finish)],
           nil ];
    outA = [CCSequence actions:
            [CCOrbitCamera actionWithDuration: duration_/2 radius: 1 deltaRadius:0 angleZ:outAngleZ deltaAngleZ:outDeltaZ angleX:0 deltaAngleX:0],
            [CCHide action],
            [CCDelayTime actionWithDuration:duration_/2],                           
            nil ];

    [inScene_ runAction: inA];
    [outScene_ runAction: outA];

}
@end

基本的に、指定された期間の両方のシーンで一連のCCACTIONSを実行します。 CCOrbitCamera アクションは、球状の座標を使用して、画面の中央の周りにカメラを軌道に乗せます。

geekgameboard たくさんのゲームがあるMacアプリです。また、フリップなどを処理するカードクラスもあります。それが役立つことを願っています!

私はそのようなcocs2d-android-1でやっています

CCSprite sprite=CCSprite.sprite("icon.png");
CCIntervalAction a = (CCIntervalAction)CCOrbitCamera.action(2, 1, 0, 0, 360, 0, 0);
addChild(sprite,1);
sprite.runAction(CCRepeatForever.action(a));
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top