Skip to main content

Types

A type describes the properties of data. In SuperCode, data can be of the following types:

For example, the properties associated with the Player type are:

PropertyDescription
isPlayerIndicates whether the object is a player. This property is read-only.
nameThe nickname of the player. This property is read-only.
idThe ID of the player — every player in the world has a unique ID. This property is read-only.
clientIdThe network ID of the player — use this when calling functions that apply to a specific player. This property is read-only.
rotationThe current rotation of the player (in degrees).
isInvulnerableDetermines whether the player can take damage. Setting to true will allow the player to lose health when hit by weapons or hazards. Setting to false will prevent the player from losing health.
positionGets or sets the current position.
onDestroyAssigns a function that will be called when the object is destroyed. This property is write-only.
onSensorEnterAssigns a function that will be called when an object enters the sensor. This property is write-only.
onSensorExitAssigns a function that will be called when an object leaves the sensor. This property is write-only.

The properties of data can be accessed using the . the following example prints the name of a player to the log console. It uses the built-in print() function, and passes the name property from the variable named “player” (which is a Player type).

print(player.name)   <-- Prints the name of the player to the log console