void TREnemy::move(){ if(anilock){ anilockrem--; if(anilockrem <= 0){ unlock(); endAttacking(); } } atk_cd_rem--; if (isMoving()) { if(type == TREnemyRandom){ moveRandom(); }else if(type == TREnemySmart){ if(std::abs(hero->getX()-getX()) + std::abs(hero->getY()-getY()) > 100+rand()%250){ clearRoute(); moveRandom(); }else{ setVelXY(0); moveAlongPath(); } } if(turretMode){ if (--bul_cd_rem < 0) { bul_cd_rem = bul_cd; flgfire = true; } } } }
//-------------------------------------------------------------- void particleSystem::update(){ mouseLocation = ofxVec3f (ofGetAppPtr()->mouseX,ofGetAppPtr()->mouseY,0); mouseX = mouseLocation.x; mouseY = mouseLocation.y; if (mustMoveBack) { moveBack(); mustMoveBack = !mustMoveBack; } if (mustMoveToCenter) { moveToCenter(); //mustMoveToCenter = !mustMoveToCenter; } if (mustMoveRandom) { moveRandom(); //mustMoveRandom = !mustMoveRandom; } /* if (mustMoveRandomH) { moveRandomH(); //mustMoveRandomH = !mustMoveRandomH; } if (mustMoveRandomV) { moveRandomV(); //mustMoveRandomV = !mustMoveRandomV; } */ if (mustMovePaused) { movePaused(); mustMovePaused = !mustMovePaused; } particleIter = particles.begin(); while (particleIter!= particles.end()){ (*particleIter)->update(); ++particleIter; } }
void simulate() { while (RunForever || CurTime < NumTimeSteps) { synchronize(); if (MPIRank == 0) { draw(); usleep(IntervalUsecs); } else { getStuck(); } synchronize(); if (MPIRank != 0) { moveRandom(); } CurTime++; } }