osdir.com
mailing list archive

Subject: Re: [pygame] newbie question--> rendeing order - msg#00033

List: python.pygame

Date: Prev Next Index Thread: Prev Next Index
Hi Enrike.

A lot of people who are new to Pygame seem to be trepedatious to use
multiple groups. This would be a solution to your problem. You could
have two groups that get rendered, a "main" group and a "selected"
group. Just draw the sprites in the "selected" group at the end, and
they will appear on top.

On Tue, 2003-07-08 at 08:19, enrike-MaEgxoNzxhzOK8mupsKPhw@xxxxxxxxxxxxxxxx
wrote:
> hi all,
>
> i am new to pygame and phyton. i have a question that could be
> stupid for somebody with more experience. i have tried to read
> documentation and search for solutions on the net ut no luck. So
> there is goes:
> I was wondering if there is some way to change the rendering order
> of a group of sprites "on the fly". I want to bring the clicked sprite
> above the others.
> So far i have manage to do it by storing a reference of the sporites
> in a list, change the order of that list, remove all objects from the
> rendering group and adding the whole list back again to the group.
>
> I was looking for some way to access the sprites in the group and
> change the order directly. Pop the sprite that goes to the top and
> append it to the group again or sthg similar
>
> btw. my goal is to create in pygame interfaces that communicate to
> Pure Data (visual sound programming environment). and i was
> wondering which methods i could use to achive bidirectional
> comumnication from Phyton to PD. Any suggestions are welcome.
>
> many thanks in advance
--
+-------------------------------------------------------------+
| Shandy Brown Digital Thinkery |
| shandy-T7RU+DRi1nheoWH0uzbU5w@xxxxxxxxxxxxxxxx
http://www.digitalthinkery.com |
+-------------------------------------------------------------+



Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

[pygame] newbie question--> rendeing order

hi all, i am new to pygame and phyton. i have a question that could be stupid for somebody with more experience. i have tried to read documentation and search for solutions on the net ut no luck. So there is goes: I was wondering if there is some way to change the rendering order of a group of sprites "on the fly". I want to bring the clicked sprite above the others. So far i have manage to do it by storing a reference of the sporites in a list, change the order of that list, remove all objects from the rendering group and adding the whole list back again to the group. I was looking for some way to access the sprites in the group and change the order directly. Pop the sprite that goes to the top and append it to the group again or sthg similar btw. my goal is to create in pygame interfaces that communicate to Pure Data (visual sound programming environment). and i was wondering which methods i could use to achive bidirectional comumnication from Phyton to PD. Any suggestions are welcome. many thanks in advance

Next Message by Date: click to view message preview

Re: [pygame] newbie question--> rendeing order

hi sb the problem is that i would like to keep a hierarchy. the one clicked goes aboveand the rest one step down. if this would be a list i would pop the clicked sprite and the append it to the rendering queue so that its rendered the last one. but this is not a list. its a group, and i am not sure that the order of the group affects the rendering order. i am using the chimp example as a testing ground. voids = pygame.sprite.Group() allsprites = pygame.sprite.RenderPlain((voids)) If i am right i need to reshuffle the allsprite group. What i am doing is to remove all sprites from allsprites and then i work with voids.sprites() list to pop and append the selected one. later i add all items in voids back to allsprites. it seems to work in the chimp example but it doesn't on a more complex one i am building. suggestions? i hope all this questions don't sound too stupid. i just started working few days ago and there are many things i don't fully understand. thanks again On 8 Jul 2003 at 10:20, SB wrote: > Hi Enrike. > > A lot of people who are new to Pygame seem to be trepedatious to use > multiple groups. This would be a solution to your problem. You could > have two groups that get rendered, a "main" group and a "selected" > group. Just draw the sprites in the "selected" group at the end, and > they will appear on top. > > On Tue, 2003-07-08 at 08:19, enrike-MaEgxoNzxhzOK8mupsKPhw@xxxxxxxxxxxxxxxx > wrote: > > hi all, > > > > i am new to pygame and phyton. i have a question that could be > > stupid for somebody with more experience. i have tried to read > > documentation and search for solutions on the net ut no luck. So > > there is goes: > > I was wondering if there is some way to change the rendering order > > of a group of sprites "on the fly". I want to bring the clicked sprite > > above the others. > > So far i have manage to do it by storing a reference of the sporites > > in a list, change the order of that list, remove all objects from the > > rendering group and adding the whole list back again to the group. > > > > I was looking for some way to access the sprites in the group and > > change the order directly. Pop the sprite that goes to the top and > > append it to the group again or sthg similar > > > > btw. my goal is to create in pygame interfaces that communicate to > > Pure Data (visual sound programming environment). and i was > > wondering which methods i could use to achive bidirectional > > comumnication from Phyton to PD. Any suggestions are welcome. > > > > many thanks in advance > -- > +-------------------------------------------------------------+ > | Shandy Brown Digital Thinkery | > | shandy-T7RU+DRi1nheoWH0uzbU5w@xxxxxxxxxxxxxxxx > http://www.digitalthinkery.com | > +-------------------------------------------------------------+ >

Previous Message by Thread: click to view message preview

[pygame] newbie question--> rendeing order

hi all, i am new to pygame and phyton. i have a question that could be stupid for somebody with more experience. i have tried to read documentation and search for solutions on the net ut no luck. So there is goes: I was wondering if there is some way to change the rendering order of a group of sprites "on the fly". I want to bring the clicked sprite above the others. So far i have manage to do it by storing a reference of the sporites in a list, change the order of that list, remove all objects from the rendering group and adding the whole list back again to the group. I was looking for some way to access the sprites in the group and change the order directly. Pop the sprite that goes to the top and append it to the group again or sthg similar btw. my goal is to create in pygame interfaces that communicate to Pure Data (visual sound programming environment). and i was wondering which methods i could use to achive bidirectional comumnication from Phyton to PD. Any suggestions are welcome. many thanks in advance

Next Message by Thread: click to view message preview

Re: [pygame] newbie question--> rendeing order

hi sb the problem is that i would like to keep a hierarchy. the one clicked goes aboveand the rest one step down. if this would be a list i would pop the clicked sprite and the append it to the rendering queue so that its rendered the last one. but this is not a list. its a group, and i am not sure that the order of the group affects the rendering order. i am using the chimp example as a testing ground. voids = pygame.sprite.Group() allsprites = pygame.sprite.RenderPlain((voids)) If i am right i need to reshuffle the allsprite group. What i am doing is to remove all sprites from allsprites and then i work with voids.sprites() list to pop and append the selected one. later i add all items in voids back to allsprites. it seems to work in the chimp example but it doesn't on a more complex one i am building. suggestions? i hope all this questions don't sound too stupid. i just started working few days ago and there are many things i don't fully understand. thanks again On 8 Jul 2003 at 10:20, SB wrote: > Hi Enrike. > > A lot of people who are new to Pygame seem to be trepedatious to use > multiple groups. This would be a solution to your problem. You could > have two groups that get rendered, a "main" group and a "selected" > group. Just draw the sprites in the "selected" group at the end, and > they will appear on top. > > On Tue, 2003-07-08 at 08:19, enrike-MaEgxoNzxhzOK8mupsKPhw@xxxxxxxxxxxxxxxx > wrote: > > hi all, > > > > i am new to pygame and phyton. i have a question that could be > > stupid for somebody with more experience. i have tried to read > > documentation and search for solutions on the net ut no luck. So > > there is goes: > > I was wondering if there is some way to change the rendering order > > of a group of sprites "on the fly". I want to bring the clicked sprite > > above the others. > > So far i have manage to do it by storing a reference of the sporites > > in a list, change the order of that list, remove all objects from the > > rendering group and adding the whole list back again to the group. > > > > I was looking for some way to access the sprites in the group and > > change the order directly. Pop the sprite that goes to the top and > > append it to the group again or sthg similar > > > > btw. my goal is to create in pygame interfaces that communicate to > > Pure Data (visual sound programming environment). and i was > > wondering which methods i could use to achive bidirectional > > comumnication from Phyton to PD. Any suggestions are welcome. > > > > many thanks in advance > -- > +-------------------------------------------------------------+ > | Shandy Brown Digital Thinkery | > | shandy-T7RU+DRi1nheoWH0uzbU5w@xxxxxxxxxxxxxxxx > http://www.digitalthinkery.com | > +-------------------------------------------------------------+ >
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by