core.components.event.actions.player module

class core.components.event.actions.player.Player[source]

Bases: object

add_item(game, action)[source]

Adds an item to the current player’s inventory. The action parameter must contain an item name to look up in the item database.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Example:

>>> action.__dict__
{
    "type": "add_item",
    "parameters": [
        "Potion"
    ]
}
add_monster(game, action)[source]

Adds a monster to the current player’s party if there is room. The action parameter must contain a monster name to look up in the monster database.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: monster_name

Example:

>>> action.__dict__
{
    "type": "add_monster",
    "parameters": [
        "Bulbatux",
        "10"
    ]
}
>>> monster = core.components.monster.Monster()
>>> monster.load_from_db(action[1])
...
>>> pprint.pprint(monster.__dict__)
... {'attack': 50,
...  'attack_modifier': [u'1', u'1.1', u'1.2'],
...  'back_battle_sprite': u'resources/gfx/sprites/battle/bulbatux-back.png',
...  'body': <core.components.fusion.Body instance at 0x2d0b3f8>,
...  'defense': 7,
...  'defense_modifier': [u'1', u'1.1', u'1.2'],
...  'front_battle_sprite': u'resources/gfx/sprites/battle/bulbatux-front.png',
...  'hp': 30,
...  'hp_modifier': [u'0.9', u'1', u'1.1'],
...  'level': 0,
...  'menu_sprite': u'resources/gfx/sprites/battle/bulbatux-menu01.png',
...  'monster_id': 1,
...  'moves': [],
...  'name': u'Bulbatux',
...  'special_attack': 9,
...  'special_attack_modifier': [u'1', u'1.1', u'1.2'],
...  'special_defense': 8,
...  'special_defense_modifier': [u'1', u'1.1', u'1.2'],
...  'speed': 7,
...  'speed_modifier': [u'1', u'1.1', u'1.2'],
...  'status': 'Normal',
...  'type1': u'grass',
...  'type2': u'poison'}
...
>>> game.player1.add_monster(monster)
>>> game.player1.monsters
... [<core.components.monster.Monster instance at 0x2d0b3b0>]
player_face(game, action)[source]

Makes the player face a certain direction.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: direction

Action parameter can be: “left”, “right”, “up”, or “down”

player_resume(game, action)[source]

Makes the player resume movement.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: None

player_stop(game, action)[source]

Makes the player stop moving.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: None

teleport(game, action)[source]

Teleport the player to a particular map and coordinates

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: map_name,coordinate_x,coordinate_y

Examples:

>>> action.__dict__
{
    "type": "teleport",
    "parameters": [
        "map1.tmx",
        "5",
        "5"
    ]
}
transition_teleport(game, action)[source]

Combines the “teleport” and “screen_transition” actions to perform a teleport with a screen transition. Useful for allowing the player to go to different maps.

Parameters:
  • game (core.control.Control) – The main game object that contains all the game’s variables.
  • action (Tuple) – The action (tuple) retrieved from the database that contains the action’s parameters
Return type:

None

Returns:

None

Valid Parameters: map_name,coordinate_x,coordinate_y,transition_time_in_seconds

Examples:

>>> action.__dict__
{
    "type": "transition_teleport",
    "parameters": [
        "map1.tmx",
        "5",
        "5",
        "2",
        "2"
    ]
}