Class: Paddle

$wk$. Paddle

new Paddle(p_id, p_context, p_init)

This:
Parameters:
Name Type Description
p_id int The identifier of the paddle (i.e. the number of the paddle)
p_context CanvasRenderingContext2D The 2d context of the canvas upon which the paddle is to be drawn.
p_init Object An object that contains initialization values for the attributes rInit, xInit, yInit, vxInit, vyInit, borderWidth, borderColor, and color.
Source:

Members

<static, constant> DOWN :int

Type:
  • int
Source:

<static, constant> LEFT :int

Type:
  • int
Source:
Type:
  • int
Source:

<static, constant> UP :int

Type:
  • int
Source:

ax :Number

The x-acceleration of the paddle.
Type:
  • Number
Source:

axInit :Number

The initial x-acceleration of the paddle.
Type:
  • Number
Source:

ay :Number

The y-acceleration of the paddle.
Type:
  • Number
Source:

ayInit :Number

The initial y-acceleration of the paddle.
Type:
  • Number
Source:

borderColor :String

The color of the border of the paddle.
Type:
  • String
Source:

borderWidth :Number

The width of the border of the paddle.
Type:
  • Number
Source:

color :String

The color of the paddle.
Type:
  • String
Source:

height :Number

The he height the paddle.
Type:
  • Number
Source:

vx :Number

The x-velocity of the paddle.
Type:
  • Number
Source:

vxInit :Number

The initial x-velocity of the paddle.
Type:
  • Number
Source:

vy :Number

The y-velocity of the paddle.
Type:
  • Number
Source:

vyInit :Number

The initial y-velocity of the paddle.
Type:
  • Number
Source:

width :Number

The width of the paddle.
Type:
  • Number
Source:

x :Number

The x-position of the paddle.
Type:
  • Number
Source:

xInit :Number

The initial x-position of the paddle.
Type:
  • Number
Source:

y :Number

The y-position of the paddle.
Type:
  • Number
Source:

yInit :Number

The initial y-position of the paddle.
Type:
  • Number
Source:

Methods

draw()

Draws the paddle at its current position onto a 2d context.
Source:

move(p_delta_t)

Moves the paddle in direction (vx,vy); the step size depends on FPS.
Parameters:
Name Type Description
p_delta_t Number The time elapsed since the last call of move.
Source:

reset()

Resets the paddle: Moves the paddle to its starting position.
Source:

start(p_direction)

Starts the paddle moving in a particular direction.
Parameters:
Name Type Description
p_direction int Either $wk$.Paddle.LEFT, $wk$.Paddle.RIGHT, $wk$.Paddle.UP, or $wk$.Paddle.DOWN.
Source:

stop()

Stops the paddle moving.
Source:
W. Kowarschick © 2013 (CC BY-NC-SA 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/)
Documentation generated by JSDoc 3.3.0-dev on Sat Nov 16 2013 10:57:52 GMT+0100 (MEZ) using the DocStrap template.