rocket simulation game with just using tkinter
Christian Gollwitzer
auriocus at gmx.de
Tue Oct 4 04:20:12 EDT 2016
Am 02.10.16 um 14:46 schrieb Irmen de Jong:
> On 1-10-2016 22:07, Irmen de Jong wrote:
>> Oh, I'm sorry about that, my little knowledge of non-US keyboard layouts shows.
>> Arrow keys could be an option. For my education what are the 2 keys to the right of
>> the P then on your keyboard?
>>
>> Rebinding the keys should be easy though just change them in the keypress and keyrelease
>> methods.
>
> I've updated the keybindings and you can now use [ and ] but also the cursor keys to
> control the rocket's rotation.
Thanks! It works now with the cursor keys as intended. I'm still having
trouble, but only because my game playing skills are not very good ;)
> Also I've discovered that there seems to be an issue with some Tkinter versions; it
> sometimes doesn't update the screen fast enough. On OSX this problem is not present but
> it is on Python 2.7 on Windows for example. I don't know what is causing it or how to
> fix it at this time. The FPS counter in the top right of the window should say 30,
> that is when the game is updating at the intended speed.
Maybe if the system is simply too slow for your intended speed ? I see
that you are using after_idle if the delay is less than 1 ms. after_idle
performs a different task than after. I think, instead you should skip
frames, i.e. compute how many frames you are behind the clock and
advance the physics by that and draw the next frame instead. Otherwise
the delay might build up.
The drawing itself has also different speed on different system. And,
the canvas is not intended to redraw everything on each frame. Instead,
updating the objects using the coords() method is usually faster. (It
should also be easier)
Christian
>
>
> Irmen
>
More information about the Python-list
mailing list