Just looking over it quickly, I think it's your use of
window.push_handlers inside the move function. Push handlers will push
more handlers onto a handler stack. So first time its called you have
one handler. When move is called a second time, now you have two
handlers, both the same, so the function will be called twice. Then 3
handlers. Then 4 handlers. They just stack up and up causing the speed
to increase more and more with each keypress event being called multiple
times.
Remember that if you "return True" after your handler (your move(dt)
function) the event wont propagate up the handler stack. And even though
this might cause the behavoir to go away, this is NOT a solution, it's
just hiding the symptom, because you are still building a massive
handler stack with ongoing tank movement, which will eventually slow the
game to a crawl and eventually cause memory to run out.
Hope this helps
Regards
Crispin
On 17/03/13 06:13, Pranav Salunke wrote:
Hey Guys,
I made a simple prototype for my own testing of Pyglet and I found
one weird bug in my code which I could not nail no matter how many
times I go through the same. The bug is that the speed of the
moving sprite gradually increases and the sprite gets faster and
faster as the number of clicks increase. Is there any suggestion
as what may be causing this. Thanks a lot.
I have attached the Tar Ball containing the code.
Regards,
Pranav
--
You received this message because you are subscribed to the Google
Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.