-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Issue #119) Added pause functionality to builtins #123
base: master
Are you sure you want to change the base?
(Issue #119) Added pause functionality to builtins #123
Conversation
examples/asteroids/main.py
Outdated
@@ -3,6 +3,7 @@ | |||
import operator | |||
|
|||
from pygame.math import Vector2 | |||
from pgzero.builtins import pause, is_paused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to import the builtins - anything in builtins is already available.
|
||
if update: | ||
if update and not paused: | ||
pgzclock.tick(dt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong - pgzclock needs to run if not paused, even if update is not defined.
pgzero/game.py
Outdated
@@ -243,7 +250,7 @@ def mainloop(self): | |||
|
|||
pgzclock = pgzero.clock.clock | |||
|
|||
self.need_redraw = True | |||
self.need_redraw = not paused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right - this is at the start of the game while the pause state will change during the game loop.
Moving the logic for need_redraw to more relevant places
Related to the following issue: #119