Animation* GameCritterObject::setActionAnimation(std::string action)
{
    Animation* animation = new Animation("art/critters/" + _generateArmorFrmString() + action + ".frm", orientation());
    animation->play();
    auto queue = new AnimationQueue();
    queue->setRepeat(true);
    queue->animations()->push_back(animation);
    queue->start();
    setUI(queue);
    return animation;
}
Animation* GameCritterObject::_generateMovementAnimation()
{
    std::string frmString = _generateArmorFrmString();

    if (_running)
    {
        frmString += "at";
    }
    else
    {
        frmString += _generateWeaponFrmString() + "b";
    }

    return new Animation("art/critters/" + frmString + ".frm", orientation());
}
Example #3
0
UI::Animation* CritterObject::setActionAnimation(const std::string& action)
{
    UI::Animation* animation = new UI::Animation("art/critters/" + _generateArmorFrmString() + action + ".frm", orientation());
    animation->addEventHandler("animationEnded", [animation](Event::Event* event)
    {
        animation->setCurrentFrame(0);
    });
    animation->play();
    /*auto queue = new AnimationQueue();
    queue->setRepeat(true);
    queue->animations()->push_back(animation);
    queue->start();*/
    setUI(animation);
    return animation;
}