If I understand your question correctly, you can use the __getattr__ and __setattr__ pair or property decorators (I think using the latter is more pythonic and correct) to "pass on" a change in position on an Entity to a sprite. On 22 May 2013 10:55, "Busata" <[email protected]> wrote:
> Hello, > > I've just started using Pyglet for creating a small 2D sidescrolling game, > and as a test to get an entity/component system running. > > I was trying to use a Position and Renderable component, in order for my > Renderer system to render the sprites/tiles. > > Now, the problem is that to render the sprites, I was hoping to use the > Sprite / Batch system that's present in Pyglet, but the position of the > Sprite > is updated in the Sprite itself. I was hoping I could draw it by taking > the data from the Position component. > > Any suggestions if there's an easy way to split the Sprite image data and > its position while still allowing the batch to draw them correctly? > I would like to avoid having to update both (Sprite/Position). I assume > its a bit overdesigning but I would like to maintain the possiblity for > entities to have a Position > without having to be rendered and curious if it can be solved the way I > want it :-) > > > Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pyglet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyglet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
