collision detection between ball and this brick
(self, ball)
| 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 | """ |