Constructors

- IsoCharacter

Constructor Summary

This is a behavior to be used by characters in the isometric world of wade.iso.

Fields Summary

maxStepHeight
maxStepHeight
The maximum height difference between two tiles that will allow this character to move from one tile to the next.
movementSpeed
movementSpeed
The movement speed of the character (in world units per second).
name
name
The name of the behavior.
variationProbability
variationProbability
How likely it is that an idle animation (if present) will be played when the character is idle

Functions Summary

Remove any destinations that were added with setDestination()
Get the next destination
goToObject
(object)
Move towards an object.
setDestination
(gridCoords)
Set a destination (a tile to move to) for the character.
setDirection
(direction)
Set a direction to face.
Set a movement type for this character.
startWandering
(probability,
stepDistance,
targetObject)
Start moving around in random directions
Stop moving around in random directions

Constructor Details

()
This is a behavior to be used by characters in the isometric world of wade.iso. It handles movement, pathfinding, movement queues, and more.

Fields Details


The maximum height difference between two tiles that will allow this character to move from one tile to the next. Default is 20.


The movement speed of the character (in world units per second). Note that changing this won't affect any movement that is currently in progress, only future movements. Default is 160.


The name of the behavior. This is set to 'IsoCharacter'.


How likely it is that an idle animation (if present) will be played when the character is idle

Function Details

()
Remove any destinations that were added with setDestination()

()
Get the next destination

Returns:


{Object}
An object with x and z fields representing the next destination, or null if there are no destinations in the queue

(object)
Move towards an object. If the object has an interactionOffset field set in its object data, the character will try to go there. If that is not possible (or no interaction offset is set) the character will try to move to the object's tile. If that is not possible (because the object has a collision map), it will try to move to any tile next to the object

Parameters:


{SceneObject|string}object
An object (or a string with the name of the object) to move towards.

(gridCoords)
Set a destination (a tile to move to) for the character.

Parameters:


{{x: number|z: number}}gridCoords
The isometric tile coordinates to move to

Returns:


{boolean}
Whether it was possible to add the destination (i.e. it isn't blocked by objects with collisions)

(direction)
Set a direction to face. This will change the idle animation that is currently playing, and won't have any effect if the character is moving.

Parameters:


{string}direction
The direction to face. It can be one of ['n', 'e', 's', 'w'] (if you have set the isometric movement type to 'straight'), one of ['ne', 'nw', 'se', 'sw'] (if you have set the isometric movement type to 'diagonal', which is the default), or any one of either set (if you have the isometric movement type ot 'both')

(type)
Set a movement type for this character.

Parameters:


{string}type
A string describing the movement type. It can be 'diagonal', 'straight' or 'both'. If omitted, the character will use the default movement type (the one that was set with wade.iso.init(), or, if it wasn't set, 'diagonal').

(probability,
stepDistance,
targetObject)
Start moving around in random directions

Parameters:


{number}probability
A number between 0 and 1 indicating the movement probability. Lower numbers will make the character move less often.
{number}stepDistance
The maximum number of tiles that each movement can span
{SceneObject|string}targetObjectOptional
An isometric object (or its name as a string) that the character will try to keep close to while wandering.
()
Stop moving around in random directions