Constructor
new Paddle(game, boundingBox, speed)
Creates a Paddle
Parameters:
Name | Type | Description |
---|---|---|
game |
Object | The game manager class |
boundingBox |
Object | Initial size and position of this Paddle |
speed |
number | The movement speed of this paddle in pixels a second |
- Source:
Extends
Members
dimensions
Gets the bounding box dimensions of this Object
- Overrides:
- Source:
speed
Gets this Paddles current movement speed
- Source:
speed
Sets the Paddle's movement speed
- 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 Paddle 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
moveLeft(bounds, timeDelta)
Moves the paddle left based on it's speed and the time since the last update
Parameters:
Name | Type | Description |
---|---|---|
bounds |
Objects | BoundingBox the Paddle should stay within |
timeDelta |
number | The time in seconds since the last update |
- Source:
moveRight(bounds, timeDelta)
Moves the paddle right based on it's speed and the time since the last update
Parameters:
Name | Type | Description |
---|---|---|
bounds |
Objects | BoundingBox the Paddle should stay within |
timeDelta |
number | The time in seconds since the last update |
- Source:
setPosInBounds(bounds, x)
Sets the x position of this Paddle while keeping it within the boundary passed
Parameters:
Name | Type | Description |
---|---|---|
bounds |
object | BoundingBox the Paddle should stay within |
x |
number | The new x coordinate |
- Source: