Class: TorchItem

Class contents

Methods list

These are special functions (or methods) that you may call on the object. these functions typically instruct the object to perform a certain operation.
    No methods

Events list

Events are functions you add to your objects, that will be called by Cubiverse when certain things (events) occur.

Class Information

Constructor

new TorchItem()

A torch item which must be spawned through World.spawnItem() or similar API call.
Important:
  • You cannot spawn a torch directly, it must be spawned using the World.spawnItem() or similar API call.

Extends

Events

onItemEquipped

Called when a player equips the item (but does not use it)

This event is trigger when the item is equipped by a player, it does not signal that they have used it (i.e. shot a gun, turned on the torch, etc.)

Parameters:
Name Type Description
playerObject object The actual playerObject who equipped the item
Inherited From:
Example
// Print some information when a player equips an item
myItem.onItemEquipped = function( playerObject )
{
    log("I was equipped by " + playerObject.nickName) ;
}

onItemPickedUp

Called when a player picks up the item

This event is trigger on the item when any player picks up this instance of the item

Parameters:
Name Type Description
playerObject object The actual playerObject who picked it up
Inherited From:
Example
// Print some information when a player picks up something
myItem.onItemPickedUp = function( playerObject )
{
    log("I was picked up by " + playerObject.nickName) ;
}