cocos notes

1. Use Plist to add aggregated image resources

//Instantiate the plist resource
CCSpriteFrameCache *MyFrameSprite = CCSpriteFrameCache::sharedSpriteFrameCache();
MyFrameSprite->addSpriteFramesWithFile("MyGame/Game.plist");

//Find the required picture
Sprite from the resources * MyFishingSprite = Sprite::createWithSpriteFrame(MyFrameSprite->spriteFrameByName(""));

=================================== ===================================================== =
2.
//Register to capture key event listener
        auto listenerkeyPad = EventListenerKeyboard::create();
        listenerkeyPad->onKeyReleased = CC_CALLBACK_2(Game3_Manager::onKeyReleased, this);
        _eventDispatcher->addEventListenerWithSceneGraphPriority(listenerkeyPad, this);

void ClassName::onKeyReleased( EventKeyboard::KeyCode keycode, cocos2d::Event *event )
{
    if (keycode == EventKeyboard::KeyCode::KEY_ESCAPE)  //返回
    {
        
    }
}
====================================================================================
3、
//加载动画资源
    ArmatureDataManager::getInstance()->addArmatureFileInfo("che/che/che.ExportJson");
        Armature * mHuli = Armature::create("che");

    this->addChild(mHuli);

    mHuli->setPosition(Vec2(x,y));

    mHuli->getAnimation()->play("Animation1");

    mHuli->setScale(0.9f);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325399146&siteId=291194637