The computer game function collision () checks whether two circular objects collide; it returns True if they do and False otherwise. Each circular object will be given by it's radius and the (x,y) coordinates of it's center. Thus the function will take six numbers as input: the coordinates x1 and y1 of the center and the radius r1 of the first circle, and the coordinates x2 and y2 and the radius r2 of the second circle.
>>> collision (0,0,,3,0,5,3)
true
>>> collision(0,0,1.4,2,2,1.4)
false
Comments
Leave a comment