Defines the Pellet class.

class pyskool.pellet.Pellet(pellet_id, command_list_id, pellet_range, hit_zone, hit_xy)

A catapult pellet.

  • pellet_id – The ID of the pellet.
  • command_list_id – The ID of the command list the pellet will use.
  • pellet_range – The maximum distance the pellet will travel after launch.
  • hit_zone – The size of the portion at the end of the pellet’s journey in which it can hit things.
  • hit_xy – The coordinates of the pellet within its sprite (used for collision detection).

Return the ID of the command list used by the pellet.

Parameters:lesson_id – The ID of the current lesson (ignored - pellets do not follow a timetable).

Return the coordinates of the pellet adjusted for comparison with the coordinates of a cup, shield or conker.


Return whoever has been hit by this pellet, or None if no one was hit.


Check whether the pellet hit a conker in the tree, and make the conker fall if so.

Returns:True if the pellet hit a conker, False otherwise.

Check whether the pellet hit a cup, and spill its contents if so.

Returns:True if the pellet hit a cup containing water, sherry or a frog, False otherwise.

Check whether the pellet hit a shield, and make the shield flash or unflash as appropriate if so.

Returns:True if the pellet hit a shield, False otherwise.
impeded(bottom_y, top_y)

Return whether the pellet is blocked by an object (such as a wall).

  • bottom_y – The y-coordinate of the bottom of the object.
  • top_y – The y-coordinate of the top of the object.
launch(x, y, direction)

Launch the pellet from a starting point.

  • x – The x-coordinate of the starting point.
  • y – The y-coordinate of the starting point.
  • direction – The direction the pellet will travel.

Previous topic


Next topic