Re: [pygame] sprite collisions - looking for simple snippet

2009-07-14 Thread Paulo Silva
@Zack - here is the smaller example i were promissed - http://pastebin.com/f65869385 - an idea about handling 4 players on one keyboard - a very fun experience i wished to see more common on Pygame games! ;) - it recalls a bit like those early 90's arcade games with 3 or 4 players on the same

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Henrique Nakashima
Traceback (most recent call last): File col.py, line 52, in module collide=pygame.sprite.collide_rect(sprid[0],sprid[1]) File C:\Python25\lib\site-packages\pygame\sprite.py, line 1146, in collide_r ect return left.rect.colliderect(right.rect) AttributeError: 'pygame.Surface' object has

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Paulo Silva
@Zack - what i wanted were change the background colour to #FF only when the sprites 0 and 1 collides - anyway, sorry this code is not PEP8, and using abbreviated variable names - i came from hobbystic 80's ansi-basic , where i were hugelly one-liner, and variable names only took 1 or 2

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Zack Schilling
Well, this version runs. I'm not sure if it's doing what you want but it does make a windows and draws some stuff. The subsurface splits are correct. I tried to make minimal corrections. http://pastebin.com/m1e1c7c94 -Zack On Jul 13, 2009, at 11:47 AM, Paulo Silva wrote: @Zack - what i

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Paulo Silva
well, the exact answer i can say is 'yes and no'... ;) the 'yes' is finally i can start understanding how collisions works on pygame, and this is truly wonderful! thank you! the 'no' is, when i did use 'if' over coordinates and size calculations instead of collisions -

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Zack Schilling
It only shows one sprite because you're filling the screen each and every time you draw one. That's also part of the reason why your code is so incredibly slow. Delete this line: screen.fill(0x998877) And move it before the for loop: screen.fill(0x998877) for i in range (0,amnt,1):

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Zack Schilling
Making code more pythonic doesn't necessarily mean meeting the PEP8 style guidelines, it just means turning the ideas that you have into code in the most direct way that best uses the basic features of Python. For example, python's basic collection, the list, is not an array and works best

[pygame] sprite collisions - looking for simple snippet

2009-07-12 Thread nitrofurano
hi! i'm having difficulty on coding a small nippet of sprite collisions on pygame on sdlbasic, it's extremelly simple to get working (please don't worry about PEP8... :/ ) http://img19.imageshack.us/img19/6966/bht0.png http://img19.imageshack.us/img19/8138/bht1.png

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-12 Thread Henrique Nakashima
Pygame.sprite has methods for detection collisions: pygame.sprite.spritecollide(), pygame.sprite.collide_rect(), etc. You can find their reference at http://www.pygame.org/docs/ref/sprite.html. On Sun, Jul 12, 2009 at 17:41, nitrofur...@gmail.com wrote: hi! i'm having difficulty on coding a

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-12 Thread Paulo Silva
this reference i know from a long time, and figured out easily there were the exact methods to be used - the problem is i couldn't have a snippet working only following that - on my oppinion on that referenence, each pygame method should have a working snippet to be tried out - for me is easier to

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-12 Thread René Dudfield
On Mon, Jul 13, 2009 at 7:32 AM, Paulo Silva nitrofur...@gmail.com wrote: this reference i know from a long time, and figured out easily there were the exact methods to be used - the problem is i couldn't have a snippet working only following that - on my oppinion on that referenence, each