Skip to content

(Issue #119) Added pause functionality to builtins#123

Open
lucas-james wants to merge 2 commits into
lordmauve:mainfrom
lucas-james:add-pause-builtin-functionality
Open

(Issue #119) Added pause functionality to builtins#123
lucas-james wants to merge 2 commits into
lordmauve:mainfrom
lucas-james:add-pause-builtin-functionality

Conversation

@lucas-james
Copy link
Copy Markdown
Contributor

Related to the following issue: #119

Comment thread examples/asteroids/main.py Outdated
import operator

from pygame.math import Vector2
from pgzero.builtins import pause, is_paused
Copy link
Copy Markdown
Owner

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.

Comment thread pgzero/game.py

if update:
if update and not paused:
pgzclock.tick(dt)
Copy link
Copy Markdown
Owner

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.

Comment thread pgzero/game.py Outdated
pgzclock = pgzero.clock.clock

self.need_redraw = True
self.need_redraw = not paused
Copy link
Copy Markdown
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants