Class: NPC

entity/NPC~ NPC


new NPC(x, y, key)

Parameters:
Name Type Description
x any
y any
key any
Source:

Members


dislike

For all NPCs, I am defaulting the people they dislike to monsters. This will be overridden in Monster.

Source:

dislike

For all NPCs, I am defaulting the people they dislike to monsters. This will be overridden in Monster.

Source:

maxHP

NPC Health.

Setting max HP to 100 by default.

Source:

maxHP

NPC Health.

Setting max HP to 100 by default.

Source:

type

Type of Entity

Source:

type

Type of Entity

Source:

Methods


aggro(target, navMesh [, sprint]) → {boolean}

Make the npc attack a target

Parameters:
Name Type Argument Description
target Entity

target to attack

navMesh navmesh

the navMesh of the map

sprint boolean <optional>

the navMesh of the map

Source:
Returns:

target no longer exists (probably dead)

Type
boolean

aggro(target, navMesh [, sprint]) → {boolean}

Make the npc attack a target

Parameters:
Name Type Argument Description
target Entity

target to attack

navMesh navmesh

the navMesh of the map

sprint boolean <optional>

the navMesh of the map

Source:
Returns:

target no longer exists (probably dead)

Type
boolean

gotoXY(x, y, navMesh, sprint) → {boolean}

This function tells an entity object to travel to a desired location

Parameters:
Name Type Description
x number
y number
navMesh navMesh

navigation mesh object

sprint boolean

if true go fast

Source:
Returns:

return true if finished, otherwise false.

Type
boolean

gotoXY(x, y, navMesh, sprint) → {boolean}

This function tells an entity object to travel to a desired location

Parameters:
Name Type Description
x number
y number
navMesh navMesh

navigation mesh object

sprint boolean

if true go fast

Source:
Returns:

return true if finished, otherwise false.

Type
boolean

updateAI(navMesh, topLeft, botRight, player, behavior)

Parameters:
Name Type Description
navMesh navmesh

the navMesh of the map

topLeft Phaser.Point

top left bounds the entity can wander in.

botRight Phaser.Point

bottom right bounds the entity can wander in.

player Entity

the player!

behavior string

neutral or aggresive for now

Source:

updateAI(navMesh, topLeft, botRight, player, behavior)

Parameters:
Name Type Description
navMesh navmesh

the navMesh of the map

topLeft Phaser.Point

top left bounds the entity can wander in.

botRight Phaser.Point

bottom right bounds the entity can wander in.

player Entity

the player!

behavior string

neutral or aggresive for now

Source:

wander(navMesh, topLeft, botRight)

Allow an Entity object to wander

Parameters:
Name Type Description
navMesh navMesh

the maps navigation mesh

topLeft Phaser.Point

top left cornor of the bounds (x,y) default 0,0

botRight Phaser.Point

bottom left cornor of the bounds (x,y) default map width,hieght

Source:

wander(navMesh, topLeft, botRight)

Allow an Entity object to wander

Parameters:
Name Type Description
navMesh navMesh

the maps navigation mesh

topLeft Phaser.Point

top left cornor of the bounds (x,y) default 0,0

botRight Phaser.Point

bottom left cornor of the bounds (x,y) default map width,hieght

Source:

Class: NPC

entity/NPC~ NPC


new NPC(x, y, key)

Parameters:
Name Type Description
x any
y any
key any
Source:

Members


dislike

For all NPCs, I am defaulting the people they dislike to monsters. This will be overridden in Monster.

Source:

dislike

For all NPCs, I am defaulting the people they dislike to monsters. This will be overridden in Monster.

Source:

maxHP

NPC Health.

Setting max HP to 100 by default.

Source:

maxHP

NPC Health.

Setting max HP to 100 by default.

Source:

type

Type of Entity

Source:

type

Type of Entity

Source:

Methods


aggro(target, navMesh [, sprint]) → {boolean}

Make the npc attack a target

Parameters:
Name Type Argument Description
target Entity

target to attack

navMesh navmesh

the navMesh of the map

sprint boolean <optional>

the navMesh of the map

Source:
Returns:

target no longer exists (probably dead)

Type
boolean

aggro(target, navMesh [, sprint]) → {boolean}

Make the npc attack a target

Parameters:
Name Type Argument Description
target Entity

target to attack

navMesh navmesh

the navMesh of the map

sprint boolean <optional>

the navMesh of the map

Source:
Returns:

target no longer exists (probably dead)

Type
boolean

gotoXY(x, y, navMesh, sprint) → {boolean}

This function tells an entity object to travel to a desired location

Parameters:
Name Type Description
x number
y number
navMesh navMesh

navigation mesh object

sprint boolean

if true go fast

Source:
Returns:

return true if finished, otherwise false.

Type
boolean

gotoXY(x, y, navMesh, sprint) → {boolean}

This function tells an entity object to travel to a desired location

Parameters:
Name Type Description
x number
y number
navMesh navMesh

navigation mesh object

sprint boolean

if true go fast

Source:
Returns:

return true if finished, otherwise false.

Type
boolean

updateAI(navMesh, topLeft, botRight, player, behavior)

Parameters:
Name Type Description
navMesh navmesh

the navMesh of the map

topLeft Phaser.Point

top left bounds the entity can wander in.

botRight Phaser.Point

bottom right bounds the entity can wander in.

player Entity

the player!

behavior string

neutral or aggresive for now

Source:

updateAI(navMesh, topLeft, botRight, player, behavior)

Parameters:
Name Type Description
navMesh navmesh

the navMesh of the map

topLeft Phaser.Point

top left bounds the entity can wander in.

botRight Phaser.Point

bottom right bounds the entity can wander in.

player Entity

the player!

behavior string

neutral or aggresive for now

Source:

wander(navMesh, topLeft, botRight)

Allow an Entity object to wander

Parameters:
Name Type Description
navMesh navMesh

the maps navigation mesh

topLeft Phaser.Point

top left cornor of the bounds (x,y) default 0,0

botRight Phaser.Point

bottom left cornor of the bounds (x,y) default map width,hieght

Source:

wander(navMesh, topLeft, botRight)

Allow an Entity object to wander

Parameters:
Name Type Description
navMesh navMesh

the maps navigation mesh

topLeft Phaser.Point

top left cornor of the bounds (x,y) default 0,0

botRight Phaser.Point

bottom left cornor of the bounds (x,y) default map width,hieght

Source: