User:Rmyers/Physics Game Classes

From OLPC
Jump to: navigation, search

I've just completed my first cut at breaking out the classes into a separate file. The file is called rmphysics.py.

I've reworked the text to better fit the OLPC Python coding guidelines.

Classes:

  • class DisplayObject: abstract base class, just has a pyGame surface.
  • class TextDisplayObject(DisplayObject): adds a font. needs a text render method.
  • class RedGreenBar(DisplayObject): horizontal bar that goes from red at 0% fill to green at 100%. Useful for things like progress monitors, health gauges, etc.
  • class ColorBar(DisplayObject): vertical bar with a set color
  • class TextMessage(TextDisplayObject): message that times out. Good for notifying user of important state changes without interrupting progress.
  • class PhysicsObject: an object that moves inertially across the screen, wrapping in both x and y planes.

The module contains a unit test main which exercises the classes and give a first cut example as to their use.

I've integrated the module with 'Molecules'

The module has not yet been integrated with 'Asteroids'