tuxemon.event.actions.npc_move module

final class tuxemon.event.actions.npc_move.NpcMoveAction(*args)[source]

Bases: EventAction

Relative tile movement for NPC.

This action blocks until the destination is reached.

Script usage

npc_move <npc_slug>,<move>...
Script parameters:
  • npc_slug – Either “player” or npc slug name (e.g. “npc_maple”).

  • move – A tuple with format <direction> [amount_of_tiles] where direction can be one of “up”, “down”, “left” and “right” and amount_of_tiles is the number of tiles moved in that direction, being 1 by default. Several movements can be passed, that will be executed one after the other. For example: up 10, down 5, left 5.

Parameters:

args (Any) –

name: ClassVar[str] = 'npc_move'
raw_parameters: Sequence[str]
start()[source]

Called only once, when the action is started.

For all actions, you will need to override this method.

For actions that only need to run one frame you can simply put all the code here. If the action will need to run over several frames, you can init your action here, then override the update method.

Return type:

None

update()[source]

Called once per frame while action is running.

It is also called on the first frame when EventAction is started.

If you do not override this, then the action will stop after it is started, and live for only one frame.

If you do override this, then this method will be run every frame until EventAction.stop() is called. If you do not ever call stop(), then this action will block all others in the list and will continue to run until the parent EventEngine is stopped.

Return type:

None

tuxemon.event.actions.npc_move.parse_path_parameters(origin, move_list)[source]
Parameters:
  • origin (Tuple[int, int]) –

  • move_list (Sequence[str]) –

Return type:

Generator[Tuple[int, int], None, None]

tuxemon.event.actions.npc_move.simple_path(origin, direction, tiles)[source]
Parameters:
  • origin (Tuple[int, int]) –

  • direction (Literal['up', 'down', 'left', 'right']) –

  • tiles (int) –

Return type:

Generator[Tuple[int, int], None, None]