Constructors

IsoCharacter

Constructor Summary

IsoCharacter

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 Summary

IsoCharacter.maxStepHeight

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

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.
IsoCharacter.name

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

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

Functions Summary

IsoCharacter.clearDestinations ()

Remove any destinations that were added with setDestination()
IsoCharacter.getNextDestination ()

Get the next destination
IsoCharacter.goToObject (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.
IsoCharacter.setDestination (gridCoords)

Set a destination (a tile to move to) for the character.
IsoCharacter.setDirection (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.
IsoCharacter.setMovementType (type)

Set a movement type for this character.
IsoCharacter.startWandering (probability, stepDistance, targetObject)

Start moving around in random directions
IsoCharacter.stopWandering ()

Stop moving around in random directions

Constructor Details

IsoCharacter

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

IsoCharacter.maxStepHeight

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

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.
^
IsoCharacter.name

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

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

Function Details

IsoCharacter.clearDestinations ()

Remove any destinations that were added with setDestination()
^
IsoCharacter.getNextDestination ()

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

^
IsoCharacter.goToObject (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.
When the character reaches the object, an onObjectReached event is fired

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

^
IsoCharacter.setDestination (gridCoords)

Set a destination (a tile to move to) for the character.
When the character reaches its destination, an onDestinationReached event is fired.

{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)

^
IsoCharacter.setDirection (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.

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')

^
IsoCharacter.setMovementType (type)

Set a movement type for this character.

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').

^
IsoCharacter.startWandering (probability, stepDistance, targetObject)

Start moving around in random directions

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 targetObject (optional): An isometric object (or its name as a string) that the character will try to keep close to while wandering.

^
IsoCharacter.stopWandering ()

Stop moving around in random directions
^