[Tutor] Teach-yourself game design site... for Python?

2008-01-18 Thread James Newton
Hi folks, I've just come across this article on the BBC site: You can see some of the games that are either created collaboratively or designed to be improved collaboratively at:

Re: [Tutor] Programming Ideas, need some focus

2008-01-16 Thread James Newton
Eric Abrahamsen wrote > I spent some time this afternoon googling the One Laptop Per Child > (OLPC) project (the GUI is done with Python and PyGTK), to see if > there were any collaborative open-source projects I could contribute > to. Seems like a perfect opportunity to get a little more Python

Re: [Tutor] Iterating backwards

2008-01-11 Thread James Newton
Kent Johnson wrote: >I guess counters is iterable but not a sequence. Try this: > for vCounter in reversed(list(counters)): Hi Kent, Thanks for your help. This solves my problem: vPos = pygame.mouse.get_pos() for vCounter in reversed(list(counters)): if vCounter.rect.collidep

[Tutor] Iterating backwards

2008-01-11 Thread James Newton
Hi Pygamers, I have created a series of pygame sprites. Visually, these sprites represent counters and may overlap. I want to determine which sprite the user clicked on. This seems to me to be a fairly standard feature of a game interface, so I imagine that there is already a standard technique

[Tutor] Opening a window to fit an image

2008-01-10 Thread James Newton
Hi Python Pros, I want to create a window to fit an image that I read in on the fly. I'm using pygame to load images and to create the window. I find I have to use pygame.display.set_mode() twice: once to allow me to use pygame.image.loadfile(), and once to reset the window size after I have been

Re: [Tutor] Scope and elegance revisited

2008-01-09 Thread James Newton
Kent Johnson wrote: >> To give you the context: my application allows you to select a skin for >> the user interface. I want to set the access path to the skin folder as >> a class variable, so that all instances of that class use images from >> the appropriate folder. The access path will be re

[Tutor] Scope and elegance revisited

2008-01-09 Thread James Newton
Hi Python Purists! I want all instances of a given class to share a piece of information, but I want to set that information on the fly. I have found that this works: class Foo(object): # class_variable = None # There is no real need to declare this def __init__(self):

Re: [Tutor] Scope and elegance

2008-01-07 Thread James Newton
Kent Johnson [mailto:[EMAIL PROTECTED] wrote: > Why does a Counter need to know about screen position? > It sounds like the Counter might be doing too much. > Maybe the Counters should be attributes of the Board > which can ask them their index numbers and do the > appropriate drawing? > Maybe the

[Tutor] Scope and elegance

2008-01-07 Thread James Newton
Hi Python Practicioners! I'm trying to come to terms with how Python handles the scope of objects. In particular, I'd like to create an instance of one class and make it available inside instances of other classes. Something like: # Test 1- # I want a "globa

Re: [Tutor] Snakes and Ladders (is: PNG transparency)

2008-01-04 Thread James Newton
Hello again Python Programmers! To reply to my own question: -Original Message- I'm importing a graphic named Counter_1.png for the counter. I'd like its background to be transparent, using the PNG's built-in alpha channel. -- I've modified the code at...

[Tutor] Snakes and Ladders

2008-01-04 Thread James Newton
Hi Python People! I've recently started learning Python in order to create educational content for the One Laptop Per Child project: The first application I'm working on is a game of Snakes and Ladders, to help younger children understand the conce