### Navigation

- index
- modules |
- next |
- previous |
- Pyskool 1.1.2 documentation »

# eric

Defines the `Eric` class.

class `eric.``Eric`(character_id, config, name, head_xy, flags, bend_over_hand_xy)

  This class represents our hero.

  Parameters: | character_id – Unique ID. config (dict) – Configuration parameters from the ini file. name – Display name. head_xy – The coordinates of Eric’s head within his sprite when he’s standing upright (used for collision detection). flags – Character flags. bend_over_hand_xy – The coordinates of Eric’s hand within his left-facing BENDING_OVER sprite (used to determine where a mouse or frog should be when caught or released).

  `aim_catapult`()

    Make Eric aim his catapult (raise it to eye level). Also alert any lines-givers in the vicinity, and play a sound effect.

  `alert_lines_givers`(message_id, reset_delay=False)

    Look for a lines-giver in the vicinity of Eric; if one is found, make him give lines to Eric.

    Parameters: | message_id – The ID of the lines message to scream. reset_delay – Whether to reset the lines-giving delay.

  `bend_over`()

    Make Eric bend over (as when catching or releasing mice).

  `can_bend_over`()

    Return whether Eric can bend over. This will be True if and only if he has a `BENDING_OVER` sprite defined.

  `can_drop_stinkbomb`()

    Return whether Eric can drop a stinkbomb. This will be True if `can_drop_stinkbomb()` (on `Character`) returns True and Eric has a stinkbomb and is standing on a floor (as opposed to a staircase).

  `can_dump_water_pistol`()

    Return whether Eric can throw away the water pistol. This will be True if Eric has the water pistol and has a `BENDING_OVER` sprite defined.

  `can_fire_catapult`()

    Return whether Eric can fire a catapult. This will be True if and only if `can_fire_catapult()` (on `Character`) returns True and the conker is not falling from the tree.

  `can_fire_water_pistol`()

    Return whether Eric can fire a water pistol. This will be True if Character.can_fire_water_pistol returns True and Eric actually has the water pistol.

  `can_kiss`()

    Return whether anyone in the cast can kiss Eric.

  `can_mount_bike`()

    Return whether Eric can mount the bike at the moment. This will be True if Eric has the `RIDING_BIKE0` sprite defined and is standing next to the bike.

  `can_open_door`(door)

    Return whether Eric can open a specific door. This will be False unless the door in question is the storeroom door and Eric has the key to it.

    Parameters: | door – The door to check.

  `can_release_mice`()

    Return whether Eric can release mice at the moment. This will be True if Eric is standing on a floor (as opposed to a staircase), has at least one mouse, and can bend over.

  `can_sit_on_stairs`()

    Return whether Eric can sit on the stairs. This will be True if and only if the relevant lines message is defined.

  `catch_animal`()

    Make Eric catch any animal that is close at hand. If Eric catches something, a sound effect is played.

  `check_bike_keys`()

    Check whether any key related to bike movement has been pressed. Any bike key pressed is stored and acted upon later by another bike-related method.

  `check_combinations`(blackboard)

    Check whether the bike or storeroom combination has been written on any of the blackboards. If the bike combination has been written on a blackboard, unchain the bike and play a sound effect. If the storeroom combination has been written on a blackboard, give Eric the key to that room and play a sound effect.

  `check_cup`()

    Check whether Eric managed to reach a cup while in possession of the frog. If so, the frog is placed in the cup and a sound effect is played.

  `check_understanding`()

    Check whether Eric indicated understanding of the message just delivered to him.

  `collect_desk_contents`(desk)

    Place the contents (if any) of a desk in Eric’s inventory. Also play a sound effect if the desk is not empty.

  `deck`()

    Knock Eric out and play a suitable sound effect.

  `descend`()

    Make Eric finish a jump. If Eric jumped up to the safe, or a shield, or an open drinks cabinet while carrying a water pistol, appropriate action is taken. Eric will descend to the floor unless the jump placed him on a knocked out kid or a plant pot.

  `dethrone`()

    Push Eric out of his seat and play a suitable sound effect.

  `dismount`()

    Make Eric dismount from the bike.

  `dismounted`()

    Return whether Eric dismounted from the bike. This will be True if Eric was sitting on the saddle and ‘down’ was pressed.

  `drop_stinkbomb`()

    Make Eric drop a stinkbomb. Also alert any lines-givers in the vicinity.

  `dump_water_pistol`()

    Make Eric throw away the water pistol. The water pistol will be filled with water and placed in a desk chosen at random.

  `end_flight`()

    Play a sound effect if Eric did not land on his feet after flying out of a window or over the skool gate.

  `fall_off_plant`()

    Make Eric fall off a plant that has just died.

  `fall_to_floor`()

    Make Eric land on the floor in the sitting position, and play a sound effect.

  `fire_water_pistol`()

    Make Eric fire the water pistol. Also alert any lines-givers in the vicinity, and play a sound effect.

  `fly`(x_inc, y_inc)

    Move Eric to the next spot in his flight out of a window or over the skool gate.

    Parameters: | x_inc – The x-coordinate increment. y_inc – The y-coordinate increment.

  `freeze`()

    Attempt to freeze Eric. The attempt will fail if Eric is writing on a blackboard, or is already frozen.

    Returns: | True if Eric was frozen, False otherwise.

  `get_back_on_saddle`()

    Make Eric get back on the saddle of the bike.

  `get_lines`()

    Check whether Eric is up to anything that merits being given lines, and make any nearby teacher who can see him give the lines.

  `get_location`()

    Return the on-floor location that is closest to Eric.

  `get_location_above_hand`()

    Return the location above Eric’s hand. This location will be used to check for the presence of a shield, the safe, or a cup.

  `got_back_on_saddle`()

    Return whether Eric got back on the saddle of the bike. This will be True if Eric was standing on the saddle and ‘down’ was pressed.

  `has_stinkbomb`()

    Return whether Eric has at least one stinkbomb.

  `has_water_pistol`()

    Return whether Eric has a water pistol (containing either water or sherry).

  `hide`()

    Hide Eric. This is used when Eric is kissing someone, and two sprites become one.

  `hit_barrier`(bike)

    Return the wall, door or Eric-stopping character that Eric rode the bike into (if any).

    Parameters: | bike – The bike Eric is riding.
    Returns: | The barrier that was hit, or None if none was hit.

  `is_absent`()

    Return whether Eric is playing truant.

  `is_eric`()

    Return whether this character is Eric.

    Returns: | True.

  `is_supported`()

    Return whether Eric is standing on something that prevents him from falling. The things that can prevent Eric from falling are:

    - a floor
    - a staircase
    - a knocked out kid
    - a plant pot
    - a plant
  `jump`()

    Make Eric jump. Also alert any lines-givers in the vicinity.

  `jumped_off_saddle`()

    Return whether Eric jumped off the saddle of the bike. This will be True if Eric was standing on the saddle and ‘up’ or ‘jump’ was pressed.

  `kiss`()

    Decrease Eric’s lines total and play the kissing sound effect.

  `kissee`()

    Return the first kissable candidate in front of Eric, or None if there is none.

  `landed`()

    Return whether Eric has landed after jumping from the saddle of the bike.

  `make_sitting_sound`()

    Play a sitting sound effect. This will be a walking sound effect, chosen at random from those available.

  `make_walking_sound`(index)

    Make a walking sound effect.

    Parameters: | index – The index of the walking sound effect.

  `mount_bike`()

    Make Eric mount the bike.

  `move`()

    Move Eric. This entails checking the keyboard for relevant keypresses and moving Eric accordingly, and dealing with Eric if he’s currently engaged in an action such as firing the catapult or water pistol (during which keypresses are ignored).

    Returns: | -1 if the screen should scroll right, 1 if it should scroll left, or 0 if it should not scroll (after moving Eric).

  `move_bike`()

    Move the bike (while Eric’s on it).

  `open_desk`(desk)

    Make Eric raise a desk lid.

    Parameters: | desk – The desk to open.

  `open_door`()

    Open the door that Eric is facing.

    Returns: | 0 (to indicate that the screen should not scroll).

  `paralyse`(command_list_id)

    Signal that Eric is paralysed (as after falling from the top-floor window). Mr Wacker will be alerted.

    Parameters: | command_list_id – The ID of the command list Mr Wacker should switch to.

  `pedal`()

    Make Eric pedal the bike. The Eric-on-a-bike sprite is moved to the next phase of animation.

  `pedalled`()

    Return whether Eric pedalled the bike since the last time he was moved. This will be True if and only if:

    - he is sitting on the saddle, and
    - ‘left’ or ‘right’ was pressed, and
    - the bike key pressed on the last call is different from the one pressed on this call
  `play_sound`(sound_id, mode=1)

    Play a sound effect.

    Parameters: | sound_id – The ID of the sound effect. mode – See `sound.Beeper.play()`.

  `print_inventory`()

    Print Eric’s inventory.

  `print_mouse_inventory`()

    Print Eric’s mouse inventory.

  `punch`()

    Make Eric throw a punch. Also alert any lines-givers in the vicinity.

  `reinitialise`()

    Perform generic reinitialisation of Eric.

  `release_mice`()

    Make Eric release some mice.

  `should_get_along`()

    Return whether Eric is somewhere other than he should be.

  `stand_on_saddle`()

    Make Eric stand on the saddle of the bike.

  `stand_up`()

    Make Eric stand up (after sitting down or bending over).

  `stood_on_saddle`()

    Return whether Eric stood on the saddle of the bike. This will be True if Eric was sitting on the saddle and ‘up’ was pressed.

  `take_safe_key`()

    Make Eric collect the safe key. A celebratory sound effect will be played.

  `understood_message`()

    Return whether Eric understood the message just delivered to him.

  `unfreeze`()

    Unfreeze Eric.

  `unhide`()

    Unhide Eric. Eric’s pre-kiss coordinates are restored.

  `walk`(on_stairs=False)

    Move Eric one step in the direction he is facing. If Eric moves close enough to the left or right edge of the screen, it will scroll.

  `write`()

    Control Eric when he’s writing on a blackboard.

    Returns: | True if Eric has finished writing, False otherwise.

### Navigation

- index
- modules |
- next |
- previous |
- Pyskool 1.1.2 documentation »