In pyglet sprites are basically just a convenience wrapper around a
quad of vertices stored in a vertex list. Unlike some other game libs
(pygame comes to mind), sprites are not typically drawn individually,
instead they are just used as an abstraction to manipulate the vertex
list inside a Batch object. The batch object itself is what is drawn.

Pyglet Group objects are not groups of sprites objects (I think the
name is unfortunate), they are an abstraction for an OpenGL state and
can also be used to specify the draw order. One or more vertex lists
can belong to a group and groups can be nested. Sprite groups allow
sprites with common state (texture, blending , etc) to be drawn with
maximum efficiency since OpenGL state changes are fairly expensive.

Pyglet does not have a built-in way to nest sprites in the manner you
describe. This functionality would need to be built by you, or you
could use a scene management library like cocos2d.

-Casey

On Fri, Feb 12, 2010 at 2:24 AM, Philippe <[email protected]> wrote:
> Hi,
>
> still new to pyglet. I come from flash/as3 world.
> I am not sure how to use group.
>
> In AS3, there is Sprite.
> Sprite can be moved (x, y), ...
> But we can also add Sprites to a Sprite.
>
> That means that a Sprite can contain other Sprites, and it's own
> graphics.
> then, if we move that can of Sprite, like my_sprite.x += 10, it will
> move all the sprites it contains.
>
> It's not hard to do it in python (build a class that contain a list of
> sprites, and a function x with @property ; then, shift the sprites).
>
> is it the correct way to do it with pyglet ?
>
> thanks,;
> Philippe
>
> --
> You received this message because you are subscribed to the Google Groups 
> "pyglet-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/pyglet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to