Module player

Player related variables and functions

Functions

hurt (damage, vel) Hurts the player by a specific amount and with a specified velocity.
setmetadata (key, value) Sets a metadata with a specified key-value pair to the player.
getmetadata (key, defaultValue) Gets a player metadata value with the specified key.
alert (message) Sends an alert popup to the player.
chat (message, color) Sends a chat message to the player.
safety () Teleports the player to the latest 'safe' block.
givelaser (settings) Gives the player a laser gun item with specified settings.
givesword (settings) Gives the player a sword item with specified settings.
giverocket (settings) Gives the player a rocket launcher item with specified settings.
teleportto (xpos, ypos, keepvelocity) Teleports the player to the given direction.
rotate (value, amplifier) Rotates a player to a given rotation at a given speed.

Fields

team The current team the player is in.
health Player's current health.
rotation Player's current rotation in degrees.
speed Player's current speed stat.
jump Player's current jump stat.
accel Player's current acceleration stat.
gravity Strength of the gravity affecting the player.
fov Affects how far can you see (zoom).


Functions

hurt (damage, vel)
Hurts the player by a specific amount and with a specified velocity.

Parameters:

  • damage int The amount of damage done to the player. By default 1.
  • vel number The strength of the impact that pushes the player. By default 0.3.

Usage:

    player.hurt(2, 0.15)
setmetadata (key, value)
Sets a metadata with a specified key-value pair to the player.

Parameters:

  • key string Name of the metadata variable (the key)
  • value Value of the metadata variable

Usage:

    player.setmetadata("coins", 10)
getmetadata (key, defaultValue)
Gets a player metadata value with the specified key.

Parameters:

  • key string The key (metadata variable name) that's used to find its value.
  • defaultValue The value to return if the searched key does not exists. By default no specific value is returned.

Returns:

    Returns the key's value. Returns defaultValue instead if the key isn't found.

Usage:

    player.getmetadata("coins", 0)
alert (message)
Sends an alert popup to the player.

Parameters:

  • message string The message to show the player.

Usage:

    player.alert("Hello world!")
chat (message, color)
Sends a chat message to the player.

Parameters:

  • message string The message to show to the player.
  • color int The decimal (or hex) value of the RGB color to use. By default #1D5497.

Usage:

  • player.chat('hello', 0x1D5497)
  • player.chat('hello', 1922199)
safety ()
Teleports the player to the latest 'safe' block.
givelaser (settings)
Gives the player a laser gun item with specified settings. Fields: ammo(int), reload(int), damage(int), recoil(float), knockback(float), sap(int), recovery(float), speed(float), range(float), rotation(String), repeat(float), phasing(float)

Parameters:

  • settings The given laser gun item as an AS3 Object.

Usage:

    player.givelaser(toobject{ammo=5,reload=4})
givesword (settings)
Gives the player a sword item with specified settings. Fields: ammo(int), reload(int), damage(int), recoil(float), knockback(float), sap(int), recovery(float)

Parameters:

  • settings The given sword item as an AS3 Object.

Usage:

    player.givesword(toobject{ammo=5,reload=4})
giverocket (settings)
Gives the player a rocket launcher item with specified settings. Fields: ammo(int), reload(int), damage(int), recoil(float), knockback(float), sap(int), recovery(float), speed(float), accel(float), maxVel(float), range(float), rotation(String), repeat(float), phasing(float)

Parameters:

  • settings The given rocket launcher item as an AS3 Object.

Usage:

    player.giverocket(toobject{ammo=5,reload=4})
teleportto (xpos, ypos, keepvelocity)
Teleports the player to the given direction.

Parameters:

  • xpos number Teleport the player (xpos) blocks among the x-axis.
  • ypos number Teleport the player (ypos) blocks among the y-axis. A positive y teleports the player down.
  • keepvelocity boolean Determines if the player keeps their velocity after teleportation. False by default.

Usage:

    player.teleportto(3, -1, true)
rotate (value, amplifier)
Rotates a player to a given rotation at a given speed.

Parameters:

  • value (float) Sets the angle that the player will be rotated to in the nearest increment of 90.
  • amplifier (Number) Sets the speed amplifier of the rotation speed. For reference, Fez rotates at 10 amplifier.

Usage:

    player.rotate(90, 1.6)

Fields

team
The current team the player is in. By default 'none'. Teammates can't directly hurt each other unless there are players left only in that team.
health
Player's current health. The player is killed if it goes to zero or below.
rotation
Player's current rotation in degrees. Rotation can only be set to values dividable by 90 degrees.
speed
Player's current speed stat.
jump
Player's current jump stat.
accel
Player's current acceleration stat.
gravity
Strength of the gravity affecting the player.
fov
Affects how far can you see (zoom). Greater values decrease your view size.
generated by LDoc 1.4.6 Last updated 2019-09-24 19:24:02