diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-14 08:33:05 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-05-14 08:33:05 (GMT) |
commit | 66d8ad206cca48d8193785bdf685f5d1fba80f02 (patch) | |
tree | 5c5e4cf555b1586c93d9ed7f87d05bdb557c0db6 /examples/statemachine | |
parent | 3cd4b6e00e3448d880ae2335bd50f70d9a5d0fca (diff) | |
download | Qt-66d8ad206cca48d8193785bdf685f5d1fba80f02.zip Qt-66d8ad206cca48d8193785bdf685f5d1fba80f02.tar.gz Qt-66d8ad206cca48d8193785bdf685f5d1fba80f02.tar.bz2 |
Fix SpinState in Tank Game Example to spin more than 180 degrees
This was a leftover from when the setDirection() semantics were broken.
Diffstat (limited to 'examples/statemachine')
-rw-r--r-- | examples/statemachine/tankgameplugins/spin_ai/spin_ai.h | 7 | ||||
-rw-r--r-- | examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h index a331a3e..d8d3d73 100644 --- a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h +++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h @@ -18,7 +18,7 @@ public: public slots: void spin() { - m_tank->setProperty("direction", 90.0); + m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0); } protected: @@ -28,6 +28,11 @@ protected: spin(); } + void onExit(QEvent *) + { + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); + } + private: QObject *m_tank; diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h index 5cfb364..456ba01 100644 --- a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h +++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h @@ -18,7 +18,7 @@ public: public slots: void spin() { - m_tank->setProperty("direction", 90.0); + m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0); } protected: @@ -28,6 +28,11 @@ protected: spin(); } + void onExit(QEvent *) + { + disconnect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin())); + } + private: QObject *m_tank; |