Flint Particle System Forum - Changing the alpha of a particle on PARTICLES_COLLISION2011-12-13T11:27:32+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Changing the alpha of a particle on PARTICLES_COLLISIONhttp://flintparticles.org/forum/comments.php?DiscussionID=479&Focus=1620#Comment_16202011-04-28T18:21:14+01:002011-12-13T11:27:32+00:00chienhttp://flintparticles.org/forum/account.php?u=41
I am trying to reveal an object as the emitter passes over portions of it. the closest analogy I can think of is real time writing. However in trying to change the alpha I get a read only ...
Should I be taking another approach?
Thanks,
CEH]]>
Changing the alpha of a particle on PARTICLES_COLLISIONhttp://flintparticles.org/forum/comments.php?DiscussionID=479&Focus=1624#Comment_16242011-04-30T18:14:27+01:002011-04-30T18:39:21+01:00chienhttp://flintparticles.org/forum/account.php?u=41
I guess it's going to be more complicated. I just realized that I am not getting collisions using one renderer and 2 emitters.
what I need is to have detection of the particles between the two ...
what I need is to have detection of the particles between the two emitters and be able to manipulate the listened to particle(s). Hopefully this won't create too large an overhead to be possible speed wise.
function alphaParticle( event:ParticleEvent ):void {
trace("Alpha: " + event.particle.alpha); }
emitter.start( );]]>
Changing the alpha of a particle on PARTICLES_COLLISIONhttp://flintparticles.org/forum/comments.php?DiscussionID=479&Focus=1629#Comment_16292011-05-03T08:51:21+01:002011-12-13T11:27:32+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
Particles store their alpha as part of the color property (color is a 32-bit argb value). There is a read-only alpha property to get the alpha part from the color, but there is no setter.
To set ...
To set the alpha, you set the top 8 bits of the color property of the particle. In practice this means you make the particle fully opaque using
particle.color = particle.color | 0xFF000000;
and you make the particle fully transparent using
particle.color = particle.color & 0x00FFFFFF;
For collisions, as you realised the collision action only handles collisions between particles that are on the same emitter. You may be able to place all your particles on one emitter. For example, if you give the particles on emitter1 a very large lifetime, so effectively they will not die, then they could possibly be placed on emitter 0 along with the other particles. The other option is to create a custom action to handle collisions between particles on multiple emitters. The source code for the existing Collide action could be a useful start point for this.]]>
Changing the alpha of a particle on PARTICLES_COLLISIONhttp://flintparticles.org/forum/comments.php?DiscussionID=479&Focus=1632#Comment_16322011-05-03T09:53:52+01:002011-12-13T11:27:32+00:00chienhttp://flintparticles.org/forum/account.php?u=41
Ok, thanks Richard. My latest test put all the particles on one emitter but after reading your explanation I don't think I went far enough.