Home | Trees | Index | Help |
---|
|
object
--+ |WorldWidget
--+ | Sprite
Iso3dSprite
A graphical widget that defines one or more animation modes, based on images loaded from files. An animation mode is a sequence of one or more images, along with information about how long each one should be displayed. Note that a still image can be encoded as animation mode with one image.
A sprite's location is defined by its anchor
, which is
typically the center of its image. A sprite's anchor can be read and
modified via the x
and y
attributes. When a sprite changes
animation modes, the new animation mode's anchor is put at the same
position as the old animation mode's anchor.
animation
attribute. The speed with which
the animation will be cycled is specified by the animation_speed
attribute. The animation
can also be manually cycled using advance_animation
.
Method Summary | |
---|---|
| |
__getstate__(self)
| |
__setstate__(self,
state)
| |
Advance this sprite's animation by the given number of ticks. | |
What is the total time to play the current animation? | |
animation_image(self,
animation,
framenum)
| |
Draw this widget to the screen. | |
draw_scaled(self,
surface,
dx,
dy,
scalefac)
| |
goto_frame(self,
framenum)
| |
has_animation(self,
animation)
| |
move(self,
dx,
dy)
| |
move_to(self,
x,
y)
| |
num_frames(self)
| |
Move this sprite's animation to its first frame. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
Return hash(x)... | |
Return a new object with type S, a subtype of T... | |
helper for pickle | |
helper for pickle | |
Return repr(x)... | |
x.__setattr__('name', value) <==> x.name = value | |
Return str(x)... |
Property Summary | |
---|---|
animation : The name of the animation sequence that is currently used by this
sprite. | |
category : The name of this sprite's category. | |
x : The x position of this sprite's anchor. | |
y : The y position of this sprite's anchor. | |
Inherited from WorldWidget | |
rect : A pygame Rect describing the current position of this sprite's
image. |
Instance Variable Summary | |
---|---|
animation_speed : What speed to advance the animation at, in ticks/msec. | |
layer : The sprite's layer. | |
Inherited from WorldWidget | |
movement_callback : A callback method that should be called whenever the sprite is
moved. | |
NoneType |
rect : A pygame Rect describing the extent of this widget, in
world coordinates. |
Method Details |
---|
__init__(self,
category,
x=0,
y=0,
animation=None,
layer=None)
|
__getstate__(self) |
__setstate__(self, state) |
advance_animation(self, ticks)Advance this sprite's animation by the given number of ticks.
|
animation_duration(self, animation=None)What is the total time to play the current animation? |
animation_image(self, animation=None, framenum=0) |
draw(self, screen, duration, dx, dy)Draw this widget to the screen.
|
draw_scaled(self, surface, dx, dy, scalefac) |
goto_frame(self, framenum) |
has_animation(self, animation) |
move(self, dx, dy) |
move_to(self, x, y) |
num_frames(self) |
restart_animation(self)Move this sprite's animation to its first frame. |
Property Details |
---|
categoryThe name of this sprite's category. Modifying this variable will change the sprite to use a different category.
|
xThe x position of this sprite's anchor. (Read-only) |
yThe y position of this sprite's anchor. (Read-only) |
Instance Variable Details |
---|
animation_speedWhat speed to advance the animation at, in ticks/msec. If zero, then the animation will be manually controlled. |
layerThe sprite's layer. |
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Sep 22 22:52:44 2005 | http://epydoc.sf.net |