Flint Particle System Forum - adding sound to particles 2011-12-13T05:51:05+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher adding sound to particles http://flintparticles.org/forum/comments.php?DiscussionID=330&Focus=1130#Comment_1130 2010-02-27T21:56:49+00:00 2011-12-13T05:51:05+00:00 priest http://flintparticles.org/forum/account.php?u=334 I'd like to add sound files to particles as they're created, and then use collisions to trigger the sounds. Ideally I'd like to be able to set sound properties on the fly so that, for example, ...
Can someone point me in the right direction to get started? Should I extend the Particle class to add a sound property? Would I also need to change the Emitter and ParticleFactory classes, etc.?

I'm an OOP noob. I have ActionScript books on hand to help with the basics, but I would greatly appreciate as much detail and patience as you can muster. Open-source examples of similar efforts would be helpful too.

Thank you!]]>
adding sound to particles http://flintparticles.org/forum/comments.php?DiscussionID=330&Focus=1131#Comment_1131 2010-02-28T06:54:15+00:00 2011-12-13T05:51:05+00:00 priest http://flintparticles.org/forum/account.php?u=334 Update: I managed to figure out a way to do much of this — surely not the proper way (I just modified the Particle class and a couple of others) — but the urgency has passed since I have a basic ...
I may pop back in with some more refined questions shortly. If I produce something worth sharing I'll post a link. Can't thank you enough for sharing this wonderful framework.]]>
adding sound to particles http://flintparticles.org/forum/comments.php?DiscussionID=330&Focus=1134#Comment_1134 2010-03-02T02:33:04+00:00 2010-03-02T02:42:07+00:00 priest http://flintparticles.org/forum/account.php?u=334 I would like to be able to set the amplitude of a sound triggered on collision by the masses and velocities of the two objects. I'm running into some problems: I can get both their masses, but ...

  1. I can get both their masses, but I can only access velX and velY for otherObject, not for the particle referenced by the particlesCollision object. If I try to access particle.velX as follows

    public function collisionHandler( e:ParticleEvent ) {
    trace("particle velX = " + e.particle.velX);
    }


    I get the following error message: 1119: Access of possibly undefined property velX through a reference with static type org.flintparticles.common.particles:Particle.

    Substitute e.otherObject.velX above and it displays a credible velocity value. What am I missing? Also, when two particles collide, how does Flint determine which is the particle and which is the otherObject?

  2. Is it possible to configure a bounding box so that a collision is registered when a particle strikes it?

]]>
adding sound to particles http://flintparticles.org/forum/comments.php?DiscussionID=330&Focus=1149#Comment_1149 2010-03-16T14:22:00+00:00 2010-03-16T14:22:27+00:00 Richard http://flintparticles.org/forum/account.php?u=1 The normal way to add further properties to a particle is to add them to the particle's dictionary object. That way you don't have to extend or modify the Particle class at ...
particle.dictionary["sound"] = ...

The particle property of the ParticleEvent is of type Particle - the base class for 2D and 3D particles. To use it's velX property you will need to cast it to a Particle2D

public function collisionHandler( e:ParticleEvent ) {
trace("particle velX = " + Particle2D( e.particle ).velX);
}


Unfortunately the bounding box class doesn't dispatch an event when the collision occurs. It's a good suggestion and I'll add it as a feature shortly. meanwhile, you could edit the class yourself to dispatch an event when a collision occurs.]]>
adding sound to particles http://flintparticles.org/forum/comments.php?DiscussionID=330&Focus=1150#Comment_1150 2010-03-17T10:27:23+00:00 2011-12-13T05:51:05+00:00 Richard http://flintparticles.org/forum/account.php?u=1 I've now added that event to the bounding box collisions. It's in the source code in SVN already and will be in the next release. adding sound to particles http://flintparticles.org/forum/comments.php?DiscussionID=330&Focus=1192#Comment_1192 2010-05-07T23:41:08+01:00 2011-12-13T05:51:05+00:00 priest http://flintparticles.org/forum/account.php?u=334 I can't thank you enough for your responsiveness. And I'm quite excited to learn that I made a good suggestion! I've had to drop my project for a while, but am resuming now, so I will try your ...
I've had to drop my project for a while, but am resuming now, so I will try your .dictionary method.]]>