Constructor
new Ball(game, boundingBox, initalVector)
Creates a Ball
Parameters:
Name | Type | Description |
---|---|---|
game |
Object | The game manager class |
boundingBox |
Object | Initial size and position of this Ball |
initalVector |
Object | Initial movement vector of the Ball |
- Source:
Extends
Members
dimensions
Gets the bounding box dimensions of this Object
- Overrides:
- Source:
vector
Gets this Ball's current movement vector
- Source:
Methods
AbstractMethod(methodName)
Raises an error if an abstract base class method is called
Parameters:
Name | Type | Description |
---|---|---|
methodName |
string | The name of the method that is abstract |
- Overrides:
- Source:
collision(object) → {boolean}
Simple collision test between this GameObject and another
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The GameObject to check for intersection |
- Overrides:
- Source:
Returns:
true/false if colliding
- Type
- boolean
draw(ctx)
Draws this Ball on the screen
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Object | The Canvas rendering context to draw to. |
- Overrides:
- Source:
intersects(object) → {Object}
Performs a comprehensive collision test that checks where the two objects are
overlapping and indicates the closest point to move them out of collision.
Parameters:
Name | Type | Description |
---|---|---|
object |
Object | The object to check for intersection |
- Overrides:
- Source:
Returns:
a dictionary with side: axis of intersection and
pos: closest point of non-intersection
- Type
- Object
move(bounds, timeDelta)
Moves the ball based on it's movement vector and the time since the last update
Parameters:
Name | Type | Description |
---|---|---|
bounds |
Object | BoundingBox the Ball should stay within |
timeDelta |
number | The time in seconds since the last update |
- Source: