Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #find the longer line
- if rect.w >= rect.h:
- testLen = rect.w * 2
- else:
- testLen = rect.h * 2
- for scale in xrange(testLen):
- #scale the fixedDir outward
- scaledDir = tools.vectors.scale(
- direction,
- scale)
- pCV = [int(f) for f in scaledDir]
- pCV = tuple(pCV)
- #if it hits a rect
- for side in rectSides:
- #test if the pCV point collides with the sides of the rectangle
- lineRectCollision = side.collidepoint(
- pCV)
- if lineRectCollision:
- collidePoint = pCV
Advertisement
Add Comment
Please, Sign In to add comment