a hobbyist's dilemma
Terry Hancock
hancock at anansispaceworks.com
Thu Mar 30 16:35:18 EST 2006
You may find the attached files of interest. I wrote this PyGame script
in order to teach my sons (ages 8 & 10) about some programming concepts.
I intentionally avoided any function or class definitions, and tried to
use minimal Python concepts.
I think it's quite impressive that you can do a demo this simple in
PyGame. None of the examples distributed with PyGame are quite this
simple (they probably represent better program design, but this is all
about KISS).
It uses the PyGame logo (you can download that separately -- it's part
of the documentation for PyGame. You could replace it with any image
you want, of course), and makes it do a "drunkard's walk" around the
screen. Successive
versions of the script show different kinds of behaviors, from bouncing off
of the walls, to responding to key presses. Armed with this, a decent Python
book, and the PyGame API documentation (which is excellent, BTW), you should
be able to get on your way quickly. I originally called it "drunk.py",
but I figured "wiggle.py" was more PC. ;-)
I chose PyGame for this, because:
1) Like me, my kids are very motivated by "pretty pictures" -- much more
so than by "guess the number" text games. I learned how to program
using BASIC on a TRS-80 Color Computer, and just about all I did for the
first couple of years was program screen graphics.
2) It's easier to "hack" a working program than to write from scratch
3) PyGame is something they actually want to learn how to use, because I
can point to real games written using it which I know they like to play
(e.g. "SolarWolf").
4) Motivation is more important than ease or skill!
I think you can see that PyGame isn't much harder than writing a line-based
terminal program, as long as you don't expect too much (line-based programs
can be hard too, if they're complicated, of course).
Phil: I'm CC'ing you, because you may consider this contributed to
PyGame's website if you want to use it -- in fact, you can do anything
you want with it, "I consign it to the Public Domain."
Cheers,
Terry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wiggle.tgz
Type: application/x-gtar
Size: 1144 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20060330/014e6298/attachment.gtar>
More information about the Python-list
mailing list