MCPcopy Index your code
hub / github.com/geekcomputers/Python / collide

Method collide

brickout-game/brickout-game.py:189–211  ·  view source on GitHub ↗

collision detection between ball and this brick

(self, ball)

Source from the content-addressed store, hash-verified

187 return self.__isInGroup
188
189 def collide(self, ball):
190 """
191 collision detection between ball and this brick
192 """
193 brickX = self._xLoc
194 brickY = self._yLoc
195 brickW = self._width
196 brickH = self._height
197 ballX = ball._xLoc
198 ballY = ball._yLoc
199 ballXVel = ball.getXVel()
200 ballYVel = ball.getYVel()
201
202 if (
203 (ballX + ball._radius) >= brickX
204 and (ballX + ball._radius) <= (brickX + brickW)
205 ) and (
206 (ballY - ball._radius) >= brickY
207 and (ballY - ball._radius) <= (brickY + brickH)
208 ):
209 return True
210 else:
211 return False
212
213
214"""

Callers 4

updateMethod · 0.45
updateMethod · 0.45
collideMethod · 0.45
brickout-game.pyFile · 0.45

Calls 2

getXVelMethod · 0.80
getYVelMethod · 0.80

Tested by

no test coverage detected