WDTraveler

WDTraveler

Way Determined Traveler. WDTraveler > BlittedTraveler > Traveler > TravelerSkeleton. A BlittedTraveler that collides based on a WayDeterminer instance given during construction. A BlittedTraveler is also a CanvasAnimation.


Constructor

new WDTraveler(wayDeterminer, source, canvasObject, fromRectopt, xopt, yopt, widthopt, heightopt, dtopt)

Parameters:
Name Type Attributes Default Description
wayDeterminer WayDeterminer

The WayDeterminer instance to use for collisions

source Image

The source image to draw from

canvasObject CanvasObject

The CanvasObject to draw to

fromRect Rectangle <optional>
null

A Rectangle defining where to draw from

x Number <optional>

The x position of the WDTraveler

y Number <optional>

The y position of the WDTraveler

width Number <optional>

The width of the WDTraveler

height Number <optional>

The height of the WDTraveler

dt Number <optional>
.6666666667

delat time, default is tabageos.TimeKeeper._sae

Members

_addedPos

_cBB

_cpos

_deltaTime

_inDelay

_moveX

_moveY

_throttRef

_wayDeterminer

The WayDeterminer instance for collisions.

_wic

ani

animationIndexOrder

animationSpecs

blitIndex

constructor

currentAnimation

fromHeightOffset

fromWidthOffset

fromXOffset

fromYOffset

hCheckOffset

hCheckOffsetRight

lastAnim

sae

vCheckOffset

vCheckOffsetUp

Methods

animate(thrott)

Parameters:
Name Type Description
thrott Number

basicChangeDirectionAnimation()

Changes animation based on dY and dX and _veloc.x and y.

changeDirectionAnimation(left, right, up, down, keepAniIndex)

Changes the animation based on the params given.

Parameters:
Name Type Description
left Boolean
right Boolean
up Boolean
down Boolean
keepAniIndex

{Boolean{

delayedAnimateAndBlitt(thrott, milliSecondDelay, animation, clearBeforeBlitt)

Parameters:
Name Type Description
thrott Number
milliSecondDelay Number
animation String
clearBeforeBlitt Boolean

getBottomY() → {Number}

Returns:
Type
Number

getLeftX() → {Number}

Returns:
Type
Number

getMiddleX() → {Number}

Returns:
Type
Number

getMiddleY() → {Number}

Returns:
Type
Number

getRightX() → {Number}

Returns:
Type
Number

getTopY() → {Number}

Returns:
Type
Number

getUnreferencedPosition(addedX, addedY) → {MoverPoint}

Parameters:
Name Type Description
addedX
addedY
Returns:
Type
MoverPoint

landCheckHorizontal(leftRight, pNewX) → {Boolean}

Parameters:
Name Type Description
leftRight
pNewX
Returns:
Type
Boolean

landCheckVertical(topBottom, pNewY) → {Boolean}

Parameters:
Name Type Description
topBottom
pNewY
Returns:
Type
Boolean

move()

velocity is adjusted using forceApplier, then landCheckHorizontal and landCheckVertical are used to determine collisions, for each direction, if there is no collision velocity is applied to position and x y.