Sensors

With sensors, tokens can sense their environment.

Methods

sensing_on_board

Token.sensing_on_board(distance: int = 0) → bool[source]

Is the token on board if it is moving distance steps forward?

../_images/sensing_on_board1.png
Parameters

distance – Specifies the distance in front of the actuator to which the sensor reacts.

Returns

True if token is on board

sensing_token

Token.sensing_token(token_type=None, distance: int = 0)[source]

Senses if tokens are on tokens position. Returns the first found token.

../_images/sensing_token1.png
Parameters
  • token_type – filter by token type. Enter a class_name of tokens to look for here

  • distance – Specifies the distance in front of the actuator to which the sensor reacts.

Returns

First token found by Sensor

Examples

Sensing a fireplace in rpg-basic-template.py:

>>>  fireplace =  self.player.sensing_token(Fireplace)
>>>    if fireplace:
>>>      self.console.newline("Du zündest die Feuerstelle an.")
>>>      self.fireplace.burn()

sensing_tokens

Token.sensing_tokens(token_type=None, distance: int = 0)[source]

Senses if tokens are on tokens position. Returns a list of tokens.

../_images/sensing_tokens1.png
Parameters
  • token_type – filter by token type. Enter a class_name of tokens to look for here

  • distance – Specifies the distance in front of the actuator to which the sensor reacts.

Returns

All tokens found by Sensor

sensing_borders

Token.sensing_borders(distance: int = 0)[source]

Senses borders

../_images/sensing_borders1.png
Parameters

distance – Specifies the distance in front of the actuator to which the sensor reacts.

Returns

True if border was found.

sensing specific border

  • sensing_left_border(distance), sensing_right_border(distance), sensing_top_border(distance), sensing_bottom_border(distance)

    Returns True if token is sensing the border (when moving distance steps forward)

sensing_colors

Token.sensing_colors(colors, distance)[source]

Senses colors in board-background at token-position

Parameters
  • colors

  • distance – Specifies the distance in front of the actuator to which the sensor reacts.

Returns: All colors found by Sensor

sensing_point

Token.sensing_point(boardPosition)[source]

Is the token colliding with a specific (global) point?

Returns: True if point is below token