Nov-07-2018, 04:25 PM
The book has a glossary at the back (thank you Amazon preview), and the code is as you describe. No imports,
It uses Pygame Zero, which is apparently a wrapper around python/pygame that adds a few things auto-magically for you to make building games faster.
https://pygame-zero.readthedocs.io/en/st...ction.html
You need to run your program through pygame zero, since it adds a few magic things for you (like opening a window, handling OS events, defining what an Actor or a Sprite are, etc). So running like
If you haven't already installed pygame zero, you'll need to do so before that command will work, though. If python is already installed, installing pygame zero should be as easy as
Interestingly, it's installed by default on Raspbian, which is an OS for RaspberryPis, which explains (at least to me) why it's called pygameZERO, as the Zero is a relatively new version of the raspberry pi that's super inexpensive (I picked up 3 of them at $5 each).
Actor
without being imported/defined, etc. So I looked at the introduction.It uses Pygame Zero, which is apparently a wrapper around python/pygame that adds a few things auto-magically for you to make building games faster.
https://pygame-zero.readthedocs.io/en/st...ction.html
You need to run your program through pygame zero, since it adds a few magic things for you (like opening a window, handling OS events, defining what an Actor or a Sprite are, etc). So running like
python my_file.py
won't work, but pgzrun my_file.py
should work.If you haven't already installed pygame zero, you'll need to do so before that command will work, though. If python is already installed, installing pygame zero should be as easy as
pip install pgzero
.Interestingly, it's installed by default on Raspbian, which is an OS for RaspberryPis, which explains (at least to me) why it's called pygameZERO, as the Zero is a relatively new version of the raspberry pi that's super inexpensive (I picked up 3 of them at $5 each).