summaryrefslogtreecommitdiffstats
path: root/examples/statemachine
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-05 13:24:03 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-05 13:24:03 (GMT)
commit6eae8aedd14acbc4ea73f336124b0243e9ebb9c0 (patch)
tree62cab5eeff432112c10048ee19a1884ebeedca3c /examples/statemachine
parentef2c9e7e6ea543a7ca1ee23b5bbaa9dee5f77b8a (diff)
downloadQt-6eae8aedd14acbc4ea73f336124b0243e9ebb9c0.zip
Qt-6eae8aedd14acbc4ea73f336124b0243e9ebb9c0.tar.gz
Qt-6eae8aedd14acbc4ea73f336124b0243e9ebb9c0.tar.bz2
Add randomness.
Diffstat (limited to 'examples/statemachine')
-rw-r--r--examples/statemachine/errorstateplugins/seek_ai/seek_ai.h4
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);
}