Exemplo n.º 1
0
bool ComponentAnim::playAnim(StandardEnemyAnimation anim, int speed, Direction dir)
{
	if (dir == NONE)
		dir = e->dir;
	// Si la animación no existe, seguro que no se puede
	std::string name = getAnimName(anim, dir);
	if (name == "")
		return false;

	// Si la animación no tiene datos, algo va mal
	EnemyAnimData data = getAnimationData(anim, dir);
	if (data.numFrames < 0)
		return false;

	if (speed < 0)
		speed = data.animSpeed;

	// 1. Comprobación de estado actual: ¿permite manipulación?
	if (e->currentAnim != NOTHING)
		return false;
	// 2. Establecer nueva animación
	((SpriteMap*) e->graphic)->playAnim(name, speed, false, true);
	e->currentAnim = anim;

	return true;
};
Exemplo n.º 2
0
bool DBCCFactory::hasDragonBones(const std::string &skeletonName, const std::string &armatureName, const std::string &animationName)
{
    auto dragonbonesData = getDragonBonesData(skeletonName);

    if (!dragonbonesData) { return false; }

    if (!armatureName.empty())
    {
        auto armatureData = dragonbonesData->getArmatureData(armatureName);

        if (!armatureData) { return false; }

        if (!animationName.empty())
        {
            auto animationData = armatureData->getAnimationData(animationName);
            return animationData != nullptr;
        }
    }

    return true;
}