Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To detect when your own objects are destroyed, it's easier to use eventDestroyed() because it avoids having to bind to individual objects.

Availability

3.1 Beta 1 and above.

Syntax

Code Block
themeEclipse
languagejavascript
linenumberstrue
bind(functionName,gameObject);

...

ParameterTypeMandatoryDescriptionGame version
functionNameString(tick)The name of the function that should be called immediately before the gameObject is destroyed.3.1 Beta 1
gameObjectDroid object,
Structure object,
Feature object
(tick)Any game object, such as a droid, structure or feature.3.1 Beta 1

Return value

ValueTypeDescriptionGame version
undefinedUndefinedIndicates the bind was successful.3.1 Beta 1
<error>ErrorIndicates there was a problem (did you remember to specify functionName as as a string?)3.1 Beta 1

Example

Code Block
themeEclipse
languagejavascript
titleDo something when someObject is destroyed
linenumberstrue
function certainDeath(gameObject) {
  // do stuff
}
 
bind("certainDeath",someObject); // where someObject would be a droid, structure or feature object

...