diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-05 13:24:03 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-05 13:24:03 (GMT) |
commit | 6eae8aedd14acbc4ea73f336124b0243e9ebb9c0 (patch) | |
tree | 62cab5eeff432112c10048ee19a1884ebeedca3c /examples | |
parent | ef2c9e7e6ea543a7ca1ee23b5bbaa9dee5f77b8a (diff) | |
download | Qt-6eae8aedd14acbc4ea73f336124b0243e9ebb9c0.zip Qt-6eae8aedd14acbc4ea73f336124b0243e9ebb9c0.tar.gz Qt-6eae8aedd14acbc4ea73f336124b0243e9ebb9c0.tar.bz2 |
Add randomness.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/statemachine/errorstateplugins/seek_ai/seek_ai.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h index 7f108a1..83f50a7 100644 --- a/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h +++ b/examples/statemachine/errorstateplugins/seek_ai/seek_ai.h @@ -95,10 +95,10 @@ protected: qreal angleOfWall = m_lastLine.angle(); qreal newDirection; - if (qAbs(currentDirection - angleOfWall) < qAbs(angleOfWall - currentDirection)) + if (qrand() % 2 == 0) newDirection = angleOfWall; else - newDirection = -angleOfWall; + newDirection = angleOfWall - 180.0; m_turnTo->assignProperty(m_tank, "direction", newDirection); } |