FogOfWar

FogOfWar

new FogOfWar()

Source:

Creates and operates a Fog Of War effect.

Methods

addViewer(target, radius)

Source:

Adds a new object with a Field of View to rendered FOW.

Parameters:
Name Type Description
target object

target for FOG to follow, must have Xform.

radius int

radius in pixels of the viewable area.

draw(aCamera)

Source:

Draws the Fog Of War. Must be run to display Fog Of War effect.

Parameters:
Name Type Description
aCamera Camera

Camera that Fog Of War will be drawn with.

drawObject(aCamera, aObject)

Source:

Scene calls this funciton for all objects that are only visable in a Field of View. Only prints objects who's X and Y location are within a Viewer's Field of View.

Parameters:
Name Type Description
aCamera Camera

Camera where object will be drawn if visable.

aObject Object

Object with Xform to check if within a Field of View.

getFogTranslusiveness() → {Number}

Source:

Get the current value of Fog visability.

Returns:
  • Curent value of Fog visability
Type
Number

getUnexploresTranslusiveness() → {Number}

Source:

Get the current value of Unknown/Unexplored visability.

Returns:
  • Curent value of Unknown visability
Type
Number

removeViewer(target)

Source:

Removes an object from having a Field of View, does not delete object.

Parameters:
Name Type Description
target object

object to be have Field of View removed.

Returns:

True if successfully removed.

setFogTranslusiveness(fogTranslusivity)

Source:

Changes how dark the Fog state is rendered. A nubmer of 0 has the fog completely transparent. 255 sets the fog to completely opaque.

Parameters:
Name Type Description
fogTranslusivity Number

Number between 0 and 255.

setOverlay(theOverlay, width, centerX, centerY)

Source:

Creates the renderable to be displayed over areas of unknown.

Parameters:
Name Type Description
theOverlay Image

picture to be used for unknown areas.

width int

width of world in WC.

centerX int

center of WC.

centerY int

center of WC.

setUnexploresTranslusiveness(unexploredTranslusivness)

Source:

Changes how dark the Unknown/Unexplored state is rendered. A nubmer of 0 has the unknown completely transparent. 255 sets the unknown to completely opaque.

Parameters:
Name Type Description
unexploredTranslusivness Number

Number between 0 and 255.

update()

Source:

Updates the Fog Of War to match the current location of all objects with a Field of View. Must be run.

updateRadius(target, radius)

Source:

Changes the Field of View radius for object.

Parameters:
Name Type Description
target object

object that has already been created.

radius int

new radius for fild of view in World Coordinates.

Returns:

True if radius successfully updated.