### Navigation

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

# mutable

Classes for things in the skool that change appearance depending on their state. For example, a cup that may be empty or contain water or sherry.

class `mutable.``Bike`(x, y)

  Represents the portion of the tree that may or may not have a bike chained to it.

  Parameters: | x – The x-coordinate of the bike-on-a-tree image. y – The y-coordinate of the bike-on-a-tree image.

  `build_images`()

    Build the images for the bike. This method is called after rescaling the screen or loading a saved game.

  `chain`()

    Return a 2-tuple containing a list of the images to use when the bike is chained to the tree, and the coordinates of the images.

  `get_images`()

    Return a 2-tuple containing a list of images of the current state of the bike, and the coordinates at which to draw the bike.

  `set_images`(unchained_images, chained_images)

    Define the images to use for the bike-on-a-tree.

    Parameters: | unchained_images – A list of images to use when the bike is not chained to the tree. chained_images – A list of images to use when the bike is chained to the tree.

  `unchain`()

    Return a 3-tuple containing a list of the images to use when the bike is not chained to the tree, and the coordinates of the images.

class `mutable.``Cup`(cup_id, coords, water_id, sherry_id)

  A cup that may be empty or filled with water or sherry.

  Parameters: | cup_id – The ID of the cup. coords – The coordinates of the cup. water_id – The ID of the liquid for which the water-filled image should be used. sherry_id – The ID of the liquid for which the sherry-filled image should be used.

  `build_images`()

    Build the images for the cup. This method is called after rescaling the screen or loading a saved game.

  `fill`(contents)

    Fill the cup with a liquid, or empty it.

    Parameters: | contents – The liquid to fill the cup with, or None to empty it.
    Returns: | The images for and location of the cup.

  `get_images`()

    Return a 2-tuple containing a list of images of the current state of the cup, and the coordinates at which to draw the cup.

  `insert_frog`(frog)

    Insert a frog into the cup.

    Parameters: | frog (`Frog`) – The frog.

  `is_empty`()

    Return whether the cup is empty (contains no liquid or frogs).

  `remove_frog`(frog)

    Remove a frog from the cup.

    Parameters: | frog (`Frog`) – The frog.

  `set_images`(empty_images, water_images, sherry_images)

    Define the images to use for the cup.

    Parameters: | empty_images – A list of images of the cup when empty. water_images – A list of images of the cup when filled with water. sherry_images – A list of images of the cup when filled with sherry.

class `mutable.``Flashable`(x, y, images, inverse_images, score=0)

  Abstract superclass for objects that flash (shields and the safe).

  Parameters: | x – The x-coordinate of the object. y – The y-coordinate of the object. images – A list of normal images of the object. inverse_images – A list of inverse images of the object. score – The points awarded for hitting the object.

  `build_images`()

    Build the images for this object. This method is called after rescaling the screen or loading a saved game.

  `flash`()

    Mark the object as flashing.

  `get_images`(inverse)

    Return a 2-tuple containing a list of images of the object, and the coordinates at which it should be drawn.

    Parameters: | inverse – If True, return the inverse images; otherwise return the normal images.

  `unflash`()

    Mark the object as not flashing.

class `mutable.``Safe`(x, y, images, inverse_images, score=0)

  A safe that will flash or unflash when hit.

class `mutable.``Shield`(x, y, images, inverse_images, score=0)

  A shield that will flash or unflash when hit.

### Navigation

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