Class PlayerData

Data required to create a player

See also:

Usage:

    -- Create a special for player
    joe_special = Special.new()
    
    -- Create the player.
    new_player = PlayerData.new("joe", "The slowest player.")
    
    -- Setup the player.
    new_player:set_special(joe_special)
    new_player:set_color(Color.new(255, 0, 0, 255))
    ...
    
    -- Register the player.
    new_player_id = new_player:register()
    
    -- Put the player into a default shop.
    shop.add_item(builtin_shop.anvil, item_kind.player, new_player_id, item_cost.diamonds, 100)
    

Functions

PlayerData.new (name, desc) Creates a new PlayerData

Methods

PlayerData:set_special (id) Sets the special of a PlayerData Player.
PlayerData:set_color (color) Sets the color of a PlayerData Player.
PlayerData:set_sprite (id) Sets the sprite of a PlayerData Player.
PlayerData:register () Finalizes a PlayerData object and returns a Player id.


Functions

Methods
PlayerData.new (name, desc)
Creates a new PlayerData

Parameters:

  • name string The name of the player
  • desc string A description of the player

Methods

PlayerData:set_special (id)
Sets the special of a PlayerData Player.

Parameters:

  • id integer The special id
PlayerData:set_color (color)
Sets the color of a PlayerData Player.

Parameters:

  • color Color The new color of the player
PlayerData:set_sprite (id)
Sets the sprite of a PlayerData Player.

Parameters:

  • id integer The id of the new sprite
PlayerData:register ()
Finalizes a PlayerData object and returns a Player id.

Returns:

    integer The id of the created player.
generated by LDoc 1.5.0 Last updated 2024-05-23 11:40:37