demos/sub-attaq/torpedo.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    62     QPropertyAnimation *launchAnimation = new QPropertyAnimation(this, "pos");
    62     QPropertyAnimation *launchAnimation = new QPropertyAnimation(this, "pos");
    63     AnimationManager::self()->registerAnimation(launchAnimation);
    63     AnimationManager::self()->registerAnimation(launchAnimation);
    64     launchAnimation->setEndValue(QPointF(x(),qobject_cast<GraphicsScene *>(scene())->sealLevel() - 15));
    64     launchAnimation->setEndValue(QPointF(x(),qobject_cast<GraphicsScene *>(scene())->sealLevel() - 15));
    65     launchAnimation->setEasingCurve(QEasingCurve::InQuad);
    65     launchAnimation->setEasingCurve(QEasingCurve::InQuad);
    66     launchAnimation->setDuration(y()/currentSpeed*10);
    66     launchAnimation->setDuration(y()/currentSpeed*10);
    67     connect(launchAnimation,SIGNAL(valueChanged(const QVariant &)),this,SLOT(onAnimationLaunchValueChanged(const QVariant &)));
    67     connect(launchAnimation,SIGNAL(valueChanged(QVariant)),this,SLOT(onAnimationLaunchValueChanged(QVariant)));
    68     connect(this,SIGNAL(torpedoExploded()), launchAnimation, SLOT(stop()));
    68     connect(this,SIGNAL(torpedoExploded()), launchAnimation, SLOT(stop()));
    69 
    69 
    70     //We setup the state machine of the torpedo
    70     //We setup the state machine of the torpedo
    71     QStateMachine *machine = new QStateMachine(this);
    71     QStateMachine *machine = new QStateMachine(this);
    72 
    72