Sep 10
Rating 3.00 out of 5
[?]

isoSetTarget.js contains a number of javascript functions to help with the attacking and targetting aspect of the game. These functions are available in javascript client side code only. You may use all or just some of these functions. Each function is listed here.

Modifying this file means that you will not be able to easily upgrade to the next version. This file could have changes made to it in a future version.

canTarget(x, y)

Returns Y or N, can position x,y be targeted. Checks the tile attribute “canTarget”

isWithinTargetRange(attackingUnitID, x, y)

Returns Y or n, if position x,y is within targetting range of attacker.

This looks for an attribute called “range”, if found it will use that to see if the distance between the attacker and x,y is equal to or less then it.

This is a true distance calculation.

showTargetRange(unit)

Displays all tiles that a unit can target. This looks for an attribute called “range”.

The maximum range available is 3.

setAsTargetTile(x, y)

Sets the tile at x,y as targettable. Turns on the mouseover and sets the attribute “canTarget” to “Y”

clearTarget(unitID)

Clears any tile so that it is no longer marked as targettable by that specific unit.