我为Android创建了一个新的Cocos2d项目,尝试将我的iOS Spritekit 2D游戏移植到Android,似乎无法弄清楚如何在Android中为Cocos2D制作动画?
iOS中我想要移植的代码如下:
SKTexture* crowTexture1 = [SKTexture textureWithImageNamed:@"crow1"];
SKTexture* crowTexture2 = [SKTexture textureWithImageNamed:@"crow2"];
SKAction* flap = [SKAction repeatActionForever:[SKAction animateWithTextures:@[crowTexture1,crowTexture2] timePerFrame:0.5]];
[crow runAction:flap];
我的cocos2d java代码如下:到目前为止:
CGSize winSize = CCDirector.sharedDirector().displaySize();
CCSprite player = CCSprite.sprite("crow1.png");
player.setPosition(CGPoint.ccp(player.getContentSize().width / 2.0f, winSize.height / 2.0f));
addChild(player);
有什么想法吗?