No problem; anyway I'm forwarding to continue in the list, if possible. More
eyes ...

---------- Forwarded message ----------
From: Max P
Date: Thu, Jun 2, 2011 at 9:21 AM
Subject: Re: Wrong texture in particles
To: claudio canepa


Sry for the direct message, but the gorup isn't working correctly :)

Ok, here are the essential parts of the sprite class:

class JetSprite(sprite.Sprite, tiles.RectMapCollider):

   def __init__(self, spawn_pos):
       super(JetSprite, self).__init__(image='res/jet.png', position
= spawn_pos)
       ...
       particle = JetSteam()
       self.add(particle, z = -1)
       ...
       self.schedule(self.update)

and this is the particle class (no Meteor() any more, but based on
Fireworks(), still with the same effect: two particle streams, on the
left the correct one with fire.png, on the right the wrong with the
sprite texture):

class JetSteam( ParticleSystem ):

   total_particles = 1000

   duration = -1

   angle = -90
   angle_var = 8

   speed = 180
   speed_var = 50

   life = 1
   life_var = 0.5

   emission_rate = total_particles / life

   start_color = Color(1,1,1,1)
   end_color = Color(0,0,0,0)

   size = 20.0


The basic parent/child architecture of the application is
GameScene(ScrollManager(Layer(Sprite(Particle())))).
Hope that helps, thx.

Max

 On 1 Jun., 18:18, claudio canepa  wrote:
 > On Wed, Jun 1, 2011 at 6:02 AM, Markus Paunger wrote:
>
>
>
>
>
> > Hey, I'm working on a simple game as a cocos2d showcase where the player
> > controls a spaceship.
> > As a nice effect, I want to add a particle system as a cloudy stream
behind
> > the spaceship and there I stumbled over a strange behavior.
>
> > The spaceship is a sprite, in its init() I add an instance of the Meteor
> > particle system to it self as a child. It works, but there is the
strange
> > effect that two particle systems are emitted, one with the seemingly
correct
> > fire.png texture but also a second with the texture of the parent
sprite,
> > although I didn't change any properties except gravity, speed, size and
> > angle.
> > You can find a snapshot of the effect here:
> >http://imageshack.us/photo/my-images/857/badparticles.png/
>
> > So is this behavior correct or is there a bug? Could't find anything so
> > far, that could explain this effect.
>
> > Thx! Max
>
> I would say thats not expected behavior.
>
> Not knowing details about your code I guess it can be some issue with
> batchs, be it cocos, pyglet or your code.
>
> Could you provide a code sample showing this defect ? That would help to
> know the why.
>
> Also, as a workaround, you can try to reverse the parent-child
relationship,
> making the meteor the parent and the sprite the child.
>
>  --
> claudio

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" 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/cocos-discuss?hl=en.

Reply via email to