SimpleIsoBox

SimpleIsoBox

A MoverSkeleton designated for isometric movement.


Constructor

new SimpleIsoBox(x, y, z, width, height, depth)

Parameters:
Name Type Description
x Number
y Number
z Number
width Number
height Number
depth Number

Default is same as height.

Members

_ddX

Future direction x

_ddY

Future direction y

_passCalcs

constructor

depth

directions

face

moveLimits

z

Methods

canPassOnMap(map, tw, th, noPassValues, offsetDivision, offsetMinus) → {Number}

Used along with .setX and .setY or the .move function. If .x and .y are updated manually this method will not compute properly. .move encapsulates this method ._ddX denoting future x direction and ._ddY denoting future y direction are used by this method.

Manual use of this method would be; this.desiredDirection(); if(this.canPassOnMap()) { this.setX(); this.setY(); }

The .move method encapsulates all those calls.

Parameters:
Name Type Description
map Array
tw Number
th Number
noPassValues Array

Array containing values the box should collide with

offsetDivision Number

The number that tw and th are divided by to account for screen/iso offset the default is 2, this number will cause the box to be closer or farther away from walls during collisions this number has a lesser effect than offsetMinus and should be from 1 to tw.

offsetMinus Number

the total offset is subtracted by this number, use this to bring the box closer or farther away from collisions, which means, when stopped, how close or far it is from the wall or object, default is 0, a game that has all boxes and scenery the same size does not really need to mess with any of the offsets. Both offsetDivision and Minus can be set during .move calls as well. .move fully encapsulates this method and all its params.

Returns:

0 or 1

Type
Number

desiredDirection(left, right, up, down, altCheckopt)

Sets ._ddX and ._ddY

Parameters:
Name Type Attributes Description
left Boolean
right Boolean
up Boolean
down Boolean
altCheck MoverSkeleton <optional>

you can pass in another MoverSkeleton to check, in that case ._ddX and ._ddY would denote its future direction. altCheck would be typically used with the .traveler of SimpleIsoCharacters that extend SimpleIsoBox.

directionFacing() → {String}

Returns:
Type
String

getX() → {Number}

Returns:
Type
Number

getY() → {Number}

Returns:
Type
Number

move(left, right, up, down, map, tw, th, npv, offd, offm) → {Boolean}

Unlike MapMovers.move method, for this method we do pass in the directions we want to go instead of the directions we are going. So we can just pass in whether or not the left button is pressed, etc.

Parameters:
Name Type Description
left Boolean
right Boolean
up Boolean
down Boolean
map Array
tw Number
th Number
npv Array

an Array containing the values that the box should collide with.

offd Number

offsetDivision for the canPassOnMap call, see canPassOnMap

offm Number

offsetMinus for the canPassOnMap call, see canPassOnMap

Returns:

Returns true when movement happened

Type
Boolean

setX(toThis)

Sets x position, and dX and face accordingly

Parameters:
Name Type Description
toThis Number

setY(toThis)

Sets y position, and dY and face accordingly.

Parameters:
Name Type Description
toThis Number