pygame: transparency question

2012-05-29 Thread Scott Siegler
Hello,

I have a surface that I load an image onto.  During a collision I would like to 
clear out the images of both surfaces that collided and show the score.  Is 
there a function call to clear a surface with an image?

One way I was thinking was to fill the surface with a color and then set that 
color as the colorkey.  Is this the only way or does pygame have a function to 
make the whole surface transparent?

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Help doing it the python way

2012-05-24 Thread Scott Siegler
Hello,

I am an experienced programmer but a beginner to python.  As such, I can figure 
out a way to code most algorithms using more C style syntax.

I am doing something now that I am sure is a more python way but i can't quite 
get it right.  I was hoping someone might help.

So I have a list of grid coordinates (x, y).  From that list, I want to create 
a new list that for each coordinate, I add the coordinate just above and just 
below (x,y+1) and (x,y-1)

right now I am using a for loop to go through all the coordinates and then 
separate append statements to add the top and bottom.

is there a way to do something like: [(x,y-1), (x,y+1) for zzz in coord_list] 
or something along those lines?

thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


pygame.Rect question

2012-04-08 Thread Scott Siegler
Hello,

I am new to Python and began using pygame to start some game programming.  I 
was hoping someone could help me out with something that seems simple but is 
really confusing me.

I am creating a rect and then using the attributes of the rect to set the size 
and location.

I set rect.left to 30, rect.top to 30 and rect.width = 20

This works fine.  However, when looking at rect.right() it shows that it is 
equal to 50. I suppose this is equal to 30+20.  However, since the first pixel 
is on location 30, wouldn't the 20th pixel be on 49 (not 50)? 

Am I missing something here?  It is really confusing me when I am doing some 
collision algorithms.

Any help?

Thanks,
Scott
-- 
http://mail.python.org/mailman/listinfo/python-list