Player
Instance of Entity. All Living and Character functions are available as well.
Player functions are accessible to all entities, but will throw if the entity is not a Player.
Player.from(entity)
Returns the entity passed in if the entity is a player, otherwise returns nil
.
player:is_local()
Used for creating small private differences between players, such as playing a sound effect, hiding a sprite, or changing a sprites color.
Returns true if the player is the local player.
Warning: Can cause unintentional desyncs. Limit behavior driven by this.
Creating or deleting sprites, entities, and animations can cause non obvious unintentional desyncs. Of course those aren't the only ways to cause unintentional desyncs.
Even modifying a sprite's color can cause a desync if another script attempts to read the sprite's color to drive behavior.
player:player_index()
Returns a number, represents the index of the player in the list of players sent from the server.
player:emotions()
Returns a list of valid values for player:set_emotion()
.
player:emotion()
Returns the name of the current emotion animation state.
player:set_emotion(state)
Sets the current animation state for the player's emotion.
If the state doesn't exist, this does nothing.
player:emotions_texture()
Returns a string.
player:emotions_animation_path()
Returns a string.
player:set_emotions_texture(path)
path
: file path relative to script file, use values returned fromResources.load_texture()
for better performance.
player:load_emotions_animation(path)
path
: file path relative to script file, use values returned fromResources.load_texture()
for better performance.
If the animation doesn't have a state matching the current emotion, it will reset the player's emotion to "DEFAULT"
player:input_has(input_query)
input_query
Input.Held.*
Input.Pressed.*
Input.Pulsed.*
Left
Right
Down
Use
Special
Shoot
FaceLeft
FaceRight
LeftShoulder
RightShoulder
Confirm
Cancel
EndTurn
Ready
Returns true if input_query
matches the player's current input state.
player:play_audio(path, audio_behavior?)
path
: file path relative to script file, use values returned fromResources.load_audio()
for better performance.audio_behavior
: AudioBehavior
Plays an audio file to only this player.
See Resources.play_audio() for playing audio for all players.
player:set_fully_charged_color(color)
color
: Color
Sets the color of the fully charged sprite.
player:set_charge_position(x, y)
Sets the offset of the fully charged sprite.
player:slide_when_moving()
Returns a bool.
player:movement_on_input()
Returns true if holding movement buttons causes the player to move.
With no calls to *:set_movement_on_input()
, the default is true.
player:set_movement_on_input(bool?)
Configures whether holding movement buttons causes the player to move, when no other augments or forms are overriding this behavior.