コード例 #1
0
BoxGroup::BoxGroup()
{
    setFlags(QGraphicsItem::ItemIsFocusable);
    // 保存变换矩阵,当BoxGroup进行旋转后,可以使用它来进行恢复
    oldTransform = transform();
    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(moveOneStep()));
    currentShape = RandomShape;
}
コード例 #2
0
bool StepperMotor::moveOneStepBackward()
{
	if (!interrupt)
	{
		stepIdx = incrementStep(stepIdx);
		moveOneStep(NUMBER_OF_STEPS - stepIdx - 1);
	}
	
	return interrupt; 
}
コード例 #3
0
bool StepperMotor::moveOneStepForward()
{
	if (!interrupt)
	{
		stepIdx = incrementStep(stepIdx);
		moveOneStep(stepIdx);
	}
	
	return interrupt;
}
コード例 #4
0
void ControllerSimpleMove::checkMoveUpdate( float delta ) {
	if(m_isMoving) {
        m_fMoveTimeCount += delta * 1000;

        if(m_fMoveTimeCount >= m_MoveSpan) {//计时器,每帧加delta*1000,如果大于设定的移动时间间隔,则将计时器置零,然后moveonesetp,应该是移动一步
            m_fMoveTimeCount = 0;
		    moveOneStep();
        }
	}
}
コード例 #5
0
void ControllerSimpleMove::checkMoveUpdate( float delta ) {
	if(m_isMoving) {
        m_fMoveTimeCount += delta * 1000;

        if(m_fMoveTimeCount >= m_MoveSpan) {
            m_fMoveTimeCount = 0;
		    moveOneStep();
        }
	}
}
コード例 #6
0
ファイル: Colony.cpp プロジェクト: wmaciel/aco-fault
void Colony::moveAnts()
{
    double oldTime = omp_get_wtime();
    static unsigned int step = 0;
    //moveUntilAllDead();
    moveOneStep();
    printDebugImage();
    double newTime = omp_get_wtime();
    std::cout << "step " << ++step << " in " << newTime - oldTime << "seconds\n";
}
コード例 #7
0
ファイル: SGSHero.cpp プロジェクト: cuongnv-ict/sghero
void SGSHero::onMoveTo(SGMessage* message)
{
  
  int x, y;
  message->getInt("x", &x);
  message->getInt("y", &y);
  SGSPoint target_pos(x,y);

  SGSPointList& path = __terrain->calcShortestPath(this, target_pos);
  if (path.empty()) {
    log("Failed to find available path");
    return;
  } else {
    path.erase(path.begin());
  }


  moveOneStep(&path);

}
コード例 #8
0
ファイル: heroreal.cpp プロジェクト: hellowzp/Ubuntu
HeroReal::HeroReal(int role, int id, const QString &name, int x, int y, int healthPercentage, int magicPercentage): Hero(role, id, name, x, y, healthPercentage, magicPercentage)
{


    //define attributes according to roles
    if (role == PLAYER_ROLE_MAGE) {

        _totalHealth = 800;
        _totalMagic = 2000;
    } else if (role == PLAYER_ROLE_PRIEST) {

        _totalHealth = 1200;
        _totalMagic = 1500;
    } else if (role == PLAYER_ROLE_WORRIOR) {

        _totalHealth = 2000;
        _totalMagic = 800;
    }

    this->_healthValue = healthPercentage * _totalHealth / 100;
    this->_magicValue = magicPercentage * _totalMagic / 100;

    QObject::connect(this, SIGNAL(needToMove()), this, SLOT(moveOneStep()));

    _sword = false;
    _armor = false;
    _boot = false;

    _isAlive = true;
    _isPaused = false;

    _magicAutoIncreaseTimer = new QTimer();
    _magicAutoIncreaseTimer->setInterval(1000);
    QObject::connect(_magicAutoIncreaseTimer, SIGNAL(timeout()), this, SLOT(magicAutoIncrease()));
    _magicAutoIncreaseTimer->start();


}
コード例 #9
0
ファイル: SGSHero.cpp プロジェクト: cuongnv-ict/sghero
void SGSHero::moveOneStepFinished(Node* node, void* ptr)
{
  SGSPointList* path = reinterpret_cast<SGSPointList*>(ptr);
  moveOneStep(path);
}