void Ghost::updateEvent(double secsElapsed) { if (!mTarget) newTarget(); //check if we caught them if (mTarget && distanceSq(pos(), mTarget->pos()) < 9.0) { mTarget->remove(); Ghost* victim = new Ghost(mTarget->pos(), world()); victim->setVelocity(mTarget->velocity()); ++mKillCount; if (mKillCount % 3 == 0) new DormantGhostPortal(pos(), world()); newTarget(); } newTargetTimer += secsElapsed; if (newTargetTimer > 30) newTarget(); assert(mTarget || !(mPursue->isOn())); Actor::updateEvent(secsElapsed); }