Sep 04
isoEngine.js
Uncategorized Add comments
[?]
isoEngine.js contains a number of javascript functions which you can use in your game. You may use all or just some of these functions. Each function is listed here, click on the function for the full API code behind it.
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.
The following list is ordered by where the function appears in the file:
- getRandomEmptyPositionBetween(minX, maxX, maxY, minY) - Returns a position that is empty on the map and within the box specified.
- getRandomNumber(min, max) - Returns a random whole number between min and max.
- removeObject(objectID) - Removes an object from the map.
- hideGameMsg() - Hides any popup game messages that might be open.
- showGameMsg(msg) - Opens up a game message window with the message in it.
- getMapHeight() - Returns the map height (y axis length)
- getMapWidth() - Returns the map width (x axis length)
- animateUnit(unitID) - starts the unit animating, unit must have a destination set or this function does nothing.
- pickNextDest(objUnit) - Part of animate unit, looks for the next tile to move to.
- moveUnit(unitID, x, y) - Moves a unit to the location, using the animate function. The x and y are tile based not pixel based.
- errorHandler(msg) - opens an alert box with the message in it, adds message to the debug panel
- getMouseOverTile(x, y) - Returns the mouse over tile at x,y
- getTop(divObj) - Returns top y position of the divObject
- getLeft(divObj) - Returns left x position of the divObject
- setAsNormalTile(x, y) - Returns a tile to its original state.
- removeUnit(unitID) - Removes a unit from the map.
- hideDebug() - Hides the debug panel
- showDebug() - Shows the debug panel
- debug(str) - Adds string to the debug panel
- getDistance(x1, y1, x2, y2) - Returns the distance between two points
- getDistanceFromUnit(unitID, x2, y2) - Returns the distance between unit and point
- getDistanceBetweenUnits(unitID, unitID2) - Returns the distance between two units
- getNearestEnemy(unitID) - Gets the nearest enemy unit
- getNearestEnemyWithinRange(unitID, range) - Gets the nearest enemy unit within attacking range
- moveToNearestEnemy(unitID) - Moves to nearest enemy unit.
- ableToWalk(x, y) - Can a unit walk on x, y?
- attackNearestEnemy(unitID) - Finds nearest enemy and calls the attack function.
- attackNearestEnemyWithinRange(unitID) - Finds nearest enemy within range and calls the attack function.
- setWaitTime(unitID, t) - Sets the wait time for a unit.
- getPropertiesOfObject(obj) - Gets the properties of an object and returns them in an array
- addUnitFromStrings(unitFields, unitInfo) - Adds a unit from string information.
- copyUnit(origUnit, newUnitID) - Duplicates a unit and gives it a new unit ID. (Does not add it to the map)
- copyTileObject(origObj, newObjectID) - Duplicates an object and gives it a new object ID. (Does not add it to the map)
- addUnit(unit) - Adds a unit to the map, unit is an object in this case.
- addTileObject(obj) - Adds a object to the map, object is an object in this case.
- addUnitFromArrays(fields, data) - Adds a unit from arrays
- showUnitMsg(unitID, msg) - Puts the message above the unit, message disappears after a few seconds.
Leave a Reply
You must be logged in to post a comment.