[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] shapes other than rects?



(sorry for the long post, it's been a while)

> i'm not so sure the line if mini_array1 and
> mini_array2
> will do the pixel-collision test correctly. i would
> think
> it would need something more like this...
> 
> if anytrue(anytrue(mini_array1 & mini_array2)):
>     print 'collide'
> else:
>     print 'miss'

hmmm, I might have an outdated numeric doc but isn't
it sometrue and if that's the case why the outer
some/anytrue if the inner one produces a bool not an
array? maybe anytrue is something else

also I was trying it out and the array resulting from
'anding' 2 numpy arrays is false if it's all zeros and
true if it's anything else, so it should work... ok,
I'll actually try it with images... tomorrow... also
on that note, I noticed if you make an array of rects
it becomes a 2D array of integers (however many rects
by 4) ... did you do that on purpose, it's cool, but I
expected an array of objects. I then thought maybe
UserRect would do that, but I can't get it to work.

also on that note, an all-zeros rect is false, which
is convenient for avoiding the probably-slow numpy
collision detection (no RLE there)... I was using
rect.move() when really I wanted to add or subtract. 
maybe some arithmetic operations on rects might be
useful at some point, does that make sense?

and finally for one of my trademark crazy naive
ideas... something that would really make surfarray
fun for experimenting with effects would be if there
was a 3rd kind of array that would have 'pixel
objects' as elements.  a pixel object could have
attributes like R, G, B, A, colorindex(bitdepth?), xy
position, magicvalue... ; overloaded operators ( > =
brighter etc.) as well as methods to look at/talk to
other pixels' attributes within its own surface. (to
get around numpy's inability to do that) I know this
would be slow but it would still be really cool.  Any
good pages for learning how to do this?  I understand
the basics of C now but the official Python/C API docs
still confuse me, and I know it can't be that bad.  It
seems like actual Python objects would take hours per
frame for something like this, but maybe not.

> anyways, good to see you're back around peter.

Thanks! you're always so tolerant of my rants, and
still so encouraging :) 

> you'll be
> glad to know surfarray has been improved since you
> last
> tried it. (i'd recommend the latest cvs for best
> surfarray results)

cool, i'll check it out -- later -- peter




__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices. 
http://auctions.yahoo.com/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org