[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Python and Speed
>Note this is not the most efficient way to do this,
>using a partitioned space you may be able to avoid
>comparing most points with one another most of the
>time. To do this in 2D you could use quad-trees, in
>3D you could use oct-trees
Just out of curiousity as a complete newbie
programmer, would you set out 2d partitioning the
screen in pygame by making say 4 invisible sprites
with rects like say:
#partition quadrants
1, 2, 3, 4 = sprites
if(while?) player collides(overlaps?) with sprite 1:
if player collides with enemy:
do x
or by just using x,y values:
if player x > 0 and < 24 and player y < 50 and > 0 and
player collides with enemy:
do x
am I even understanding partitioning correctly?
please excuse these nonworking examples.
Devon
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ