[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Turnable rect: collision checking



Hi,

I am trying to implement slopes.

To do this, I am trying to create a turnable Rect. What is the
minimum to implement for other rects being able to check whether
they collide with me? It doesn't make sense to have top, bottom,
left and right be integers because topleft != (top, left). Those
four would need to be tuples of (x, y). {top,bottom}{left,right}
don't really make sense either: should topleft mean the topmost
position or the leftmost position? More problems occur.

I am, however, able to implement collidepoint:

    return leftx < x < rightx and bottomy < y < topy

colliderect would also be possible. The real problem, however,
would occur when another rect is trying to check whether he
collides with *me*. He would probably assume that I am an
ordinary rect, and thus behave incorrectly. It this problem
solvable? I don't know C so I am unable to read the source :(.

yours,
Gerrit.

-- 
24. If persons are stolen, then shall the community and ... pay one
mina of silver to their relatives.
        -- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/