If it is the octopus won't move.
void TimerControlledGraphicsPixmapObject::startMoving()
{
void TimerControlledGraphicsPixmapObject::startMoving()
{
+ if (!stoppedBecauseInvalidTime_)
+ timer_.start();
}
void TimerControlledGraphicsPixmapObject::stopMoving()
}
void TimerControlledGraphicsPixmapObject::stopMoving()
void TimerControlledGraphicsPixmapObject::setSpeed(int speed)
{
void TimerControlledGraphicsPixmapObject::setSpeed(int speed)
{
- timer_.setInterval(1000/speed); //converts from pixels in second to milliseconds per pixel
+ if (speed >0)
+ {
+ timer_.setInterval(1000/speed); //converts from pixels in second to milliseconds per pixel
+ stoppedBecauseInvalidTime_ = false;
+ }
+ else
+ stoppedBecauseInvalidTime_ = true;
void TimerControlledGraphicsPixmapObject::move()
{
void TimerControlledGraphicsPixmapObject::move()
{
+ bool stoppedBecauseInvalidTime_;
+