Hi,
I am implementing a small game. I am using QGraphicsItemAnimation class for this. I had a background for the game as a qgraphicsitem and a plane which is also a qgraphicsitem is moving slowly on it.
My requirement is that :
If i mouse press on the plane its speed should increase for example double of previous speed and i do something on this. And I had to repeat this for 10 times. So I am keeping my loop count as 10.
On Start of the every loop the plane should move slowly from left to right. It will move fast only when mouse is pressed on it else it moves with a normal speed.
I am able to move the plane with a normal speed for 10 times. But when I change the speed it on mouse pressed it moves fast for first mouse press ... Its behavior is non recognizable.
I am changing the speed by changing the time duration of the QTimeLine on the mouse pressed event to 2 secs.
Time duration for normal speed is 8 sec.
I have connected the framechange(int ) signal to slotFrameChanged(int) of object of the QTimeLine. There I am checking The end of the frame for each Loop. I had kept 72 frames for each loop. I always compare frame count in this slot to 72. If it is 72 I change the Time Duration back to 8 secs.
But This is not working...
If anyone can help ...
Please help.
Thanks & Regards
PunitK
Bookmarks