SceneryThrower

SceneryThrower

A MapMover designated as a thrower of SceneryObjects, with methods for throwing and picking up and referencing SceneryObjects.


Constructor

new SceneryThrower(x, y, width, height, map, ca, dontCloneMap, dt, tWidth, tHeight, mr, mc)

Constructs a new SceneryThrower.

Parameters:
Name Type Description
x Number
y Number
width Number
height Number
map Array
ca CanvasAnimation
dontCloneMap Boolean
dt Number

Default is TimeKeeper._sae

tWidth Number

tile width

tHeight Number

tile height

mr Number

map rows

mc Number

map columns

See:

Members

_canvasAnimation

_outAltered

constructor

health

holding

Designated to hold a reference to whatever is being held.

holdingOffsetX

holdingOffsetY

holdingRect

nameOfThrower

throwStrength

Methods

_throwHolding()

Sets this.holding to null.

alteredPosition(xAlterAmount, yAlterAmount) → {MoverPoint}

Returns a reference to altered position.

Parameters:
Name Type Description
xAlterAmount Number
yAlterAmount Number
Returns:
Type
MoverPoint

holdingImageRect() → {Rectangle}

Returns the from Rectangle for the SceneryObject it is holding, used to know where to draw from a sprite sheet.

Returns:
Type
Rectangle

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

Picks up a SceneryObject, this.holding will be set to the obj. and this.holdingRect will be calculated.

Parameters:
Name Type Description
obj SceneryObject

The SceneryObject to pick up.

imageWidthAdjust Number

Optional width to adjust holding rect result.

imageHeightAdjust Number

Optional height to adjust holding rect result.

Returns:

Returns true if obj was picked up.

Type
Boolean

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

Pick up TileData, this.holding will be set to the TileData passed, and the holdingRect will be calculated.

Parameters:
Name Type Description
td TileData

the TileData to pick up.

imageWidthAdjust Number

Optional width to adjust holding rect result.

imageHeightAdjust Number

Optional height to adjust holding rect result.

Returns:

Returns true of td was picked up.

Type
Boolean

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

Throws what it is holding as a SceneryObject. this.holding becomes null after this method is called.

Parameters:
Name Type Description
w Number

Tile width, default is the tile width set at construction or 16.

h Number

Tile height, default is the tile height set at construction or 16.

jumps Number

Should gravity be applied to the SceneryObject, default is 0.

Returns:
Type
SceneryObject