new Collision(p_walls, p_balls)
Creates an instance of
Collision.
The main method handleCollision detects collisions
between the ball and a wall.
This:
Parameters:
| Name | Type | Description |
|---|---|---|
p_walls |
Object | The walls of the game: An object with
four integer attributes: left,
right, top, and
bottom. |
p_balls |
Ball | The balls of the game. |
- Source:
Methods
-
handleCollision()
-
Detects collisions between the ball and a wall, between the paddle and the wall, and between the ball and the paddle. If a collision is detected, the collision is handled.
- Source:
-
handleMouseClick(p_mouse_pos)
-
Parameters:
Name Type Description p_mouse_posObject - Source:
Returns:
The index of the ball that has been hit, if any.