TankorSmash

Untitled

Feb 23rd, 2012
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #find the longer line
  2. if rect.w >= rect.h:
  3.     testLen = rect.w * 2    
  4. else:
  5.     testLen = rect.h * 2
  6.  
  7. for scale in xrange(testLen):  
  8.     #scale the fixedDir outward
  9.     scaledDir = tools.vectors.scale(
  10.                                     direction,
  11.                                     scale)
  12.    
  13.     pCV = [int(f) for f in scaledDir]
  14.    
  15.     pCV = tuple(pCV)
  16.  
  17.     #if it hits a rect
  18.     for side in rectSides:
  19.        
  20.         #test if the pCV point collides with the sides of the rectangle
  21.         lineRectCollision = side.collidepoint(
  22.                                 pCV)
  23.        
  24.         if lineRectCollision:
  25.             collidePoint = pCV
Advertisement
Add Comment
Please, Sign In to add comment