赞
踩
void Pokemon::moveTo(int x, int y) { /* stop(); state = MOVE; qreal distance = sqrt(pow(x - this->x(), 2) + pow(x - this->y(), 2)); if (x - this->x() > 0) direct = RIGHT; else direct = LEFT; int timeLength = static_cast<int>(distance / speed); if (timeLine) delete timeLine; timeLine = new QTimeLine(timeLength); timeLine->setCurveShape(QTimeLine::EaseInOutCurve); animation->setTimeLine(timeLine); animation->setTranslationAt(1, x - this->x(), y - this->y());
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。