MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / iscollision

Function iscollision

projects/car game/Game.py:352–362  ·  view source on GitHub ↗
(car1X, car1Y, maincarX, maincarY)

Source from the content-addressed store, hash-verified

350
351 # getting distance between our main car and car1
352 def iscollision(car1X, car1Y, maincarX, maincarY):
353 distance = math.sqrt(
354 math.pow(car1X - maincarX, 2) + math.pow(car1Y - maincarY, 2)
355 )
356
357 # checking if distance is smaller than 50 after then collision will occur
358
359 if distance < 50:
360 return True
361 else:
362 return False
363
364 # getting distance between our main car and car2
365 def iscollision(car2X, car2Y, maincarX, maincarY):

Callers 1

gameloopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected