TravelingSceneryThrower

TravelingSceneryThrower

A MapTraveler designated as a SceneryThrower, it's similar to a plain SceneryThrower, but can do more.


Constructor

new TravelingSceneryThrower(x, y, width, height, map, caopt, dontCloneMapopt, dtopt, tWidthopt, tHeightopt, mropt, mcopt)

Constructs a new TravelingSceneryThrower

Parameters:
Name Type Attributes Default Description
x Number

The x position of the TravelingSceneryThrower

y Number

The y position

width Number
height Number
map Array

A 2D Array denoting areas the Traveler can pass or not. 0 or [0,0] would denote a blank passable spot.

ca CanavsAnimation <optional>
dontCloneMap Boolean <optional>
dt Number <optional>
.6666666667
tWidth Number <optional>
tHeight Number <optional>
mr Number <optional>
mc Number <optional>

Members

_canvasAnimation

_displayStorageClearRect

_holdingHelperRect

_outAltered

_removedFromStorage

_tempDivs

constructor

health

holding

The Object or TileData that the TravelingSceneryThrower is holding

holdingOffsetX

The horizontal offset for when holding

holdingOffsetY

The vertical offset for when holding

holdingRect

holdings

nameOfThrower

throwStrength

Methods

_readyNextThrow()

Sets holding to the last value in holdings and updates holdingRect

_throwHolding()

Sets holding to null after first removing it from holdings if in holdings.

alteredPosition(xAlterAmount, yAlterAmount) → {MoverPoint}

Parameters:
Name Type Description
xAlterAmount
yAlterAmount
Returns:
Type
MoverPoint

displayStorage(img, cameraLayer, backgroundFromRect, bgx, bgy, tw, th, stx, sty, descriptions)

Displays each value or tileValue in holdings using the given img, backgroundFromRect, and cameraLayer.

Parameters:
Name Type Description
img Img
cameraLayer CanvasObject
backgroundFromRect Rectangle

The Rectangle defining where in the image to draw from

bgx Number

The top left of where to draw the background to

bgy Number

The top left of where to draw the background to

tw Number

The tile width

th Number

tile height

stx Number

The starting x position for the first value display

sty Number

The starting y position for the first value display

descriptions Array

An Array of [y,x, description] values where y,x matches the value of values in holdings, will cause a tool tip to appear with the description when user hovers over the displayed value.

holdingImageRect() → {Rectangle}

Returns holdingRect

Returns:
Type
Rectangle

pickUp(obj, imageWidthAdjust, imageHeightAdjust) → {Boolean}

Picks up the obj and stores it has holding

Parameters:
Name Type Description
obj Object
imageWidthAdjust Number

adjust the holdingRect width

imageHeightAdjust Number

adjust the holdingRect height

Returns:
Type
Boolean

pickUpAndStore(obj, imageWidthAdjust, imageHeightAdjust, dontReadyThrow)

Picks up the object and stores it in the holdings Array

Parameters:
Name Type Description
obj Object
imageWidthAdjust Number
imageHeightAdjust Number
dontReadyThrow Boolean

By default the obj is also made ready as holding.

pickUpAndStoreTileData(obj, imageWidthAdjust, imageHeightAdjust, dontReadyThrow) → {Boolean}

Picks up TileData and stores it in the holdings Array

Parameters:
Name Type Description
obj TileData
imageWidthAdjust Number
imageHeightAdjust Number
dontReadyThrow Boolean

Ready the last value in holdings as holding is the default behavior

Returns:
Type
Boolean

pickUpTileData(td, imageWidthAdjust, imageHeightAdjust) → {Boolean}

Picks up TileData updating holding and holdingRect

Parameters:
Name Type Description
td TileData
imageWidthAdjust Number
imageHeightAdjust Number
Returns:

Returns true if TileData was picked up

Type
Boolean

rectFromHolding(holdin) → {Rectangle}

Returns the holding Rectangle.

Parameters:
Name Type Description
holdin Object
Returns:
Type
Rectangle

removeFromDisplayedStorage(e)

Parameters:
Name Type Description
e Object

removeFromStorageByValue(tValue)

Removes the holding from holdings that has the value given.

Parameters:
Name Type Description
tValue Object

removeLastFromStorage() → {Object}

Removes the last holding from holdings and sets holding to null.

Returns:

Returns the last holding value or null.

Type
Object

throwSceneryObject(w, h, jumps) → {SceneryObject}

Throws holding as a SceneryObject.

Parameters:
Name Type Description
w Number
h Number
jumps Boolean

Default is true for setting _jumps of the SceneryObject to true.

Returns:
Type
SceneryObject

throwSceneryObjectTraveler(w, h, jumps) → {SceneryObjectTraveler}

Throws holding as a SceneryObjectTraveler

Parameters:
Name Type Description
w Number
h Number
jumps Boolean

Default is true, the SceneryObjectTraveler thrown will be effected by gravity.

Returns:
Type
SceneryObjectTraveler

valueFromHolding(holdin) → {Object}

Returns the value or tileValue of holdin

Parameters:
Name Type Description
holdin Object
Returns:
Type
Object