Phaser.Plugin. AStar

new AStar(parent)

AStar is a phaser pathfinding plugin based on an A* kind of algorythm
It works with the Phaser.Tilemap

Parameters:
Name Type Description
parent Any

The object that owns this plugin, usually Phaser.PluginManager.

Source - out/plugins/AStar/AStar.js, line 42

Classes

AStarNode
AStarPath

Members

_closed :array

An array that references nodes not to consider anymore.

Source - out/plugins/AStar/AStar.js, line 73

_debug :boolean

Boolean to debug mode, stores visited nodes, and have a cost. Disable in production.

Default Value:
  • false
Source - out/plugins/AStar/AStar.js, line 112

_distanceFunction :function

The function used to calculate distance.

Source - out/plugins/AStar/AStar.js, line 101

_findClosest :boolean

Does the findPath algorythm must calculate the closest result if destination is unreachable. If not findPath will return an empty array

Default Value:
  • true
Source - out/plugins/AStar/AStar.js, line 90

_lastPath :Phaser.Plugin.AStar.AStarPath

The last path calculated by astar.

Source - out/plugins/AStar/AStar.js, line 106

_layerIndex :number

The layer index of the tilemap that is used to store astar nodes.

Source - out/plugins/AStar/AStar.js, line 58

_open :array

An array that references nodes to be considered by the search path algorythm.

Source - out/plugins/AStar/AStar.js, line 68

_tilemap :Phaser.Tilemap

A reference to the tilemap used to store astar nodes according to the Phaser.Tilemap structure.

Source - out/plugins/AStar/AStar.js, line 53

_tilesetIndex :number

The tileset index of the tileset that handle tiles properties.

Source - out/plugins/AStar/AStar.js, line 63

_useDiagonal :boolean

Does the astar algorythm can use tile diagonal?

Default Value:
  • true
Source - out/plugins/AStar/AStar.js, line 84

_visited :array

Internal array of visited tiles, use for debug pupose.

Source - out/plugins/AStar/AStar.js, line 78

_walkablePropName :string

Wich name have the walkable propertiy in your tileset.

Default Value:
  • 'walkable'
Source - out/plugins/AStar/AStar.js, line 96

parent :Any

The parent of this plugin. If added to the PluginManager the parent will be set to that, otherwise it will be null.

Source - out/plugins/AStar/AStar.js, line 48

Methods

findPath(startPoint, goalPoint) → {Phaser.Plugin.AStar.AStarPath}

Find a path between to tiles coordinates

Parameters:
Name Type Description
startPoint Phaser.Point

The start point x, y in tiles coordinates to search a path.

goalPoint Phaser.Point

The goal point x, y in tiles coordinates that you trying to reach.

Returns:

The Phaser.Plugin.AStar.AStarPath that results

Source - out/plugins/AStar/AStar.js, line 171

setAStarMap(map, layerName, tilesetName) → {Phaser.Plugin.AStar}

Sets the Phaser.Tilemap used to searchPath into.

Parameters:
Name Type Description
map Phaser.Tilemap

the Phaser.Tilemap used to searchPath into. It must have a tileset with tile porperties to know if tiles are walkable or not.

layerName string

The name of the layer that handle tiles.

tilesetName string

The name of the tileset that have walkable properties.

Returns:

The Phaser.Plugin.AStar itself.

Source - out/plugins/AStar/AStar.js, line 125
Phaser Copyright © 2012-2016 Photon Storm Ltd.
Documentation generated by JSDoc 3.4.3 on Thu Apr 13 2017 12:05:12 GMT-0700 (PDT) using the DocStrap template.