【问题标题】:Cocos2d CCshaky3d in androidandroid中的Cocos2d CCshaky3d
【发布时间】:2023-03-03 00:18:01
【问题描述】:

我正在尝试使用 android 中的 cocos2d 在我的程序中创建抖动效果。但是当我应用抖动效果时,方向已更改并且会显示黑屏。这段代码有什么问题?

    float  width=s.getWidth()/2;
    float height=s.getHeight()/2;
    firstfireImage = CCSprite.node();
    Bitmap bm =   BitmapFactory.decodeResource(mContext.getResources(),R.drawable.image_01);
    firstfireImage=CCSprite.sprite(bm);
    firstfireImage.setPosition(240,160);


    CCShaky3D shaky=CCShaky3D.action(10,true,ccGridSize.ccg(20,30),1.0f);
    CCRotateTo rotate=CCRotateTo.action(1,190);
    //CCWaves wave=CCWaves.action(1,1.0f,true,true, ccGridSize.ccg(20,30),1);

    runAction(CCRepeatForever.action(CCSequence.actions(shaky)));
    addChild( firstfireImage,1);

【问题讨论】:

    标签: cocos2d-android


    【解决方案1】:

    将您的图像放入资产文件夹并删除 bm=... 行并尝试此操作

    firstfireImage=CCSprite.sprite("image_01.png");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多