Class: Player

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.
  • damage(damage) - Applies damage to the player. You must apply a positive value, once the health hits zero the player will die
  • health(health) - Applies health to the player. You must apply a positive value, there is no real upper limits on the health you can add (or set).

Public properties list

Properties are attributes of the object, this directly affect the object in question. Some of them can be read or written, or both.
Name Type Description
nickName string The nickName of the player
x float [READ ONLY] The current X position of the player in world space
y float [READ ONLY] The current Y position of the player in world space
z float [READ ONLY] The current Z position of the player in world space

Events list

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

Class Information

Constructor

new Player()

You cannot instigate a player directly from JS, they are created as a result of a spawning of a player - usually via onPlayerSpawn() event on a playerSpawnEntity object. Also, check out the Wiki for more information on PlayerSpawnEntity
This:

Properties:

Name Type Description
nickName string The nickName of the player
x float [READ ONLY] The current X position of the player in world space
y float [READ ONLY] The current Y position of the player in world space
z float [READ ONLY] The current Z position of the player in world space
Important:
  • You cannot instigate a player directly from normal Java-script code, it can only be created from the onPlayerSpawn() event on a playerSpawnEntity object

Methods

damage(damage)

Applies damage to the player. You must apply a positive value, once the health hits zero the player will die
Parameters:
Name Type Description
damage float The amount of damage to apply
Example
myPlayer.damage(10)

health(health)

Applies health to the player. You must apply a positive value, there is no real upper limits on the health you can add (or set).
Parameters:
Name Type Description
health float The amount of health to apply
Example
myPlayer.health(10)