コード例 #1
0
ファイル: ArmatureScene.cpp プロジェクト: songmiao/WagonWar
void TestArmatureNesting2::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
{
    Vec2 point = touches[0]->getLocation();

    Armature *armature = hero->getMount() == nullptr ? hero : hero->getMount();

    //Set armature direction
    if (point.x < armature->getPositionX())
    {
        armature->setScaleX(-1);
    }
    else
    {
        armature->setScaleX(1);
    }

    ActionInterval *move = CCMoveTo::create(2, point);
    armature->stopAllActions();
    armature->runAction(Sequence::create(move, nullptr));
}