Flint Particle System Forum - Need a little help to get started 2011-06-23T13:22:34+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher Need a little help to get started http://flintparticles.org/forum/comments.php?DiscussionID=165&Focus=659#Comment_659 2009-02-03T16:30:30+00:00 2009-02-04T07:28:26+00:00 henrik http://flintparticles.org/forum/account.php?u=151 Hi Guys Im trying to visualize alot of data using the wonderfull flint system. There althoug a couple of things I dont understand quite I would like to make a distance calculation between ...
Im trying to visualize alot of data using the wonderfull flint system.

There althoug a couple of things I dont understand quite

I would like to make a distance calculation between all the elements and the mouse cursor
I dont know if there is a build in way of doing that ?

But what I have tried is to run through all the elements like this.

for(var i:uint; i<renderer.numChildren; i++){
trace(renderer.getChildAt(i).name)
var myelement = renderer.getChildAt(i);
trace(myelement.x) // traces the elements x pos
myelement.x = 5 // This goes not work

}

I can "read" the properties of the element but not set it ?

An other question is if there is a build in way to get a element to ease to a halt and a way to ease it up to speed again ?

What a generallt is trying to do is to have around a 1000 elements moving on the screen. When the mouse gets near one (or more) they should ease to a halt and also increase in size acoording to the distance. This is because the user needs to be able to clikc each element which is har when they are really small and they are speeding about.

If any one could give me a few pointers on how to achive this it would be very thankfull

Best Regards

/Henrik



Best Regards

/Henrik]]>
Need a little help to get started http://flintparticles.org/forum/comments.php?DiscussionID=165&Focus=660#Comment_660 2009-02-03T20:52:46+00:00 2011-06-23T13:22:34+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi Henrik If you try moving the sprites directly, as you are doing, the system will immediately move them back to where they should be. You have to change the position of the particle and the ...
If you try moving the sprites directly, as you are doing, the system will immediately move them back to where they should be. You have to change the position of the particle and the sprite will follow. The particles are all in the emitter's particle array. They are usually modified by using an action - an action operates on all particles in the emitter. Your basic test, as an action, would look like this...

package
{
import org.flintparticles.common.actions.ActionBase;
import org.flintparticles.common.emitters.Emitter;
import org.flintparticles.common.particles.Particle;
import org.flintparticles.twoD.particles.Particle2D;

public class TestAction extends ActionBase
{
override public function update( emitter:Emitter, particle:Particle, time:Number ):void
{
var p:Particle2D = particle as Particle2D;
p.x = 5;
}
}
}


Add the action to the emitter with

emitter.addAction( new TestAction () );

Obviously, you need a more complex action for your project. Any actions should extend the ActionBase class or implement the Action interface. You'll probably want custom initializers too - these extend the InitializerBase class or implement the Initializer interface. Flint will take care of the rest.]]>
Need a little help to get started http://flintparticles.org/forum/comments.php?DiscussionID=165&Focus=661#Comment_661 2009-02-03T22:20:33+00:00 2011-06-23T13:22:34+01:00 henrik http://flintparticles.org/forum/account.php?u=151 ok great, sounds good. If I may I have a follow up question. (or 2 ) :-) using the update override. How should I aproach looping through all the particles to be able get thier coordinates og ...
If I may I have a follow up question. (or 2 ) :-)

using the update override. How should I aproach looping through all the particles to be able get thier coordinates og set the position ?

And how will I allow flint to regain control of the particle when I done controlling it with my custom script. ?

Basically it need to some thing like this ( in bable code ) :-)

loop all the particles
control some of the particels with at custom script
when im done controlling them, "release" them to be controlled by flint again.

I think I can code alle the behavios if it was just some normal sprites moving around by my own code. Just need to now how to do the same with flint as my friend :-)

Thanx in advance

/Henrik]]>
Need a little help to get started http://flintparticles.org/forum/comments.php?DiscussionID=165&Focus=662#Comment_662 2009-02-04T07:27:09+00:00 2009-02-04T07:27:43+00:00 Richard http://flintparticles.org/forum/account.php?u=1 The update method is called every frame and for every particle (that is the particle parameter). Any code you place in here will be used to affect every particle. If you want to base the action on ...
if( particle.x - renderer.mouseX < 50 && particle.y - renderer.mouseY < 50 )...

Your custom action is not removing control from Flint - each emitter uses a combination of all the actions assigned to it to control the particles. You are simply choosing to pass your own action as one of those controls.

Take a look at some of the actions in Flint for hints. Mouse related ones like TurnTowardsMouse could be very helpful.]]>
Need a little help to get started http://flintparticles.org/forum/comments.php?DiscussionID=165&Focus=665#Comment_665 2009-02-04T12:33:23+00:00 2011-06-23T13:22:34+01:00 henrik http://flintparticles.org/forum/account.php?u=151 ahhhhh...now I understand much better. I am now trying to give each particle a special color acording to which kind of data it represents. I would like to set this color already when they are ...
I am now trying to give each particle a special color acording to which kind of data it represents.
I would like to set this color already when they are beeing created by the emitter. Do you know how to do that ?

I would also like to give each particle a id of some sort so that when the user clicks on it I will be able to "lookup" the details in an array.

so basically:

I have a array if data that needs to be represented by particles

so again in bable code, im thinking:

loop the array
create particle, with color and size according to type
parse the currentIndex of the array to the particle to remember.

then..

user clicks on particle
get the index from clicked particle
look detalied data in the array

---

Any thoughts or pointers ?

Thanx in advance

/H]]>
Need a little help to get started http://flintparticles.org/forum/comments.php?DiscussionID=165&Focus=669#Comment_669 2009-02-09T20:13:07+00:00 2011-06-23T13:22:34+01:00 Richard http://flintparticles.org/forum/account.php?u=1 For colour, look at the color initializers like ColorInit for hints. For the id, each particle contains a Dictionary - its dictionary property - for storing custom data in. If you want to avoid the ... ColorInit for hints. For the id, each particle contains a Dictionary - its dictionary property - for storing custom data in. If you want to avoid the counter and initializers and instead use custom code to create the particles, create the particles in your code then use the addExistingParticles method to add the particles to the emitter.]]>