On Jul 10, 12:33 am, claudio canepa <[email protected]> wrote:
> On Thu, Jul 9, 2009 at 12:02 PM, jaber <[email protected]> wrote:
>
> > I tried to implement a motion blur using layer and putting all blurs
> > on it. But it seems veeery slow. FPS drops 20-30 on my old PC.
>
> > ----------------------------------
> > class BoxBlur(Layer):
> > "Box guy motion blur"
> > ...
> > def update(self,dt):
> > self.active = True if self.box.velocityVec.tuple() !=
> > box2d.b2Vec2_zero.tuple() else False
> > #print pyglet.clock._default._schedule_interval_items
> > if self.active:
> > if self.box.boosting:
> > if self.moveBlur:
> > self.unschedule(self.addMoveBlur)
> > self.moveBlur = False
> > if not self.moveBlur:
> > self.schedule_interval(self.addMoveBlur,
> > 1/500.)
> > self.moveBlur = True
>
> > elif not self.active:
> > self.moveBlur = False
> > self.unschedule(self.addMoveBlur)
>
> > def addMoveBlur(self,dt):
>
> > blur = Sprite(Images.box,opacity=200)
> > blur._group = pyglet.sprite.SpriteGroup(blur._texture,
> > GL_SRC_ALPHA, GL_ONE, None)
> > blur._create_vertex_list()
> > blur.position = self.box.position
> > blur.rotation = self.box.rotation
> > blur.color = self.box.moveColor
> > blur.scale=self.box.scale
> > self.add(blur)
>
> > blur.do(FadeOut(1.0) + self.RemoveBlur())
>
> > class RemoveBlur( InstantAction ):
> > def init(self):
> > pass
> > def start(self):
> > self.target.parent.remove(self.target)
>
> > ----------------------------------
>
> it seems you add the blur object in one frame, then remove the next, repeat.
> Probably this wasn't what you intended, besides the Sprite creation in each
> other frame would slow dow things.
> --
> Claudio
Can I use ParticleSystem? I tried set the particles velocity,etc to
zero so it will stay in place. But if I set the ParticleSystem to
follow the playersprite, the particles moves together with the emitter
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---