Module sketcher :: Class canvas :: Class sprite
[hide private]
[frames] | no frames]

Class sprite

source code

          object --+    
                   |    
            ode.Body --+
                       |
          object --+   |
                   |   |
pygame.sprite.Sprite --+
                       |
                      canvas.sprite

Abstract object represented in an area of the canvas. Objects can either be drawn manually by the user, or be imported from an image file. The resulting objects are also represented as surfaces, occupying a given region of the canvas. Parameter:

Instance Methods [hide private]
 
__init__(this, image, topleft, world)
Initialization procedure for defaulting the object's general configuration.
source code
 
update(this, x, y)
Updates the object's current position.
source code

Inherited from ode.Body: __delattr__, __getattribute__, __setattr__, addForce, addForceAtPos, addForceAtRelPos, addRelForce, addRelForceAtPos, addRelForceAtRelPos, addRelTorque, addTorque, disable, enable, getAngularVel, getFiniteRotationAxis, getFiniteRotationMode, getForce, getGravityMode, getLinearVel, getMass, getNumJoints, getPointVel, getPosRelPoint, getPosition, getQuaternion, getRelPointPos, getRelPointVel, getRotation, getTorque, isEnabled, setAngularVel, setFiniteRotationAxis, setFiniteRotationMode, setForce, setGravityMode, setLinearVel, setMass, setPosition, setQuaternion, setRotation, setTorque, vectorFromWorld, vectorToWorld

Inherited from pygame.sprite.Sprite: __repr__, add, add_internal, alive, groups, kill, remove, remove_internal

Inherited from object: __hash__, __reduce__, __reduce_ex__, __str__

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(this, image, rect, world)
Polymorphs the __new__ method in the base class ode.Body so that other supertypes can be fully initialized.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(this, image, rect, world)
Static Method

source code 

Polymorphs the __new__ method in the base class ode.Body so that other supertypes can be fully initialized. Because ode.Body is already a defined type (not a class), and therefore is immutable, defining this function ensures that upon constructing objects of this subtype, the __new__ method invokation will be done at the subtype level without conflicting the __init__ requirements for initializing the other derived classes in its multi-inherited hierarchy. This is similar to the way in which a string, int, and other immutable types can be extended even though they are not directly treated as classes. Also, importantly, the parameters passed to this method must match exactly with the parameters passed to the __init__ method. Parameter:

  • _object, the object to be represented in a canvas world; this contains the initial configuration of an object belonging to a canvas' environment.
  • world, the canvas the object belongs to (membership constraint).
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__init__(this, image, topleft, world)
(Constructor)

source code 

Initialization procedure for defaulting the object's general configuration. Parameter:

  • _object, the object to be represented in a canvas world; this contains the configuration for object's initial state in the world.
  • world, the canvas the object belongs to (membership constraint).
Overrides: object.__init__

update(this, x, y)

source code 

Updates the object's current position. Parameter:

  • x, the x-position of the object.
  • y, the y-position of the object.
Overrides: pygame.sprite.Sprite.update