The other way around, object (sprite) -> follow particles on touch

Hi,

First of all, really nice work the particles set, i've bought The candy's and the text.

I've seen that we can attach particles to an object , so the articles will follow the object, cheers.

No the other way around;

Can an object (sprite) follow a particle line and also can the object rotate to it so it's following this line as within flight ctonrol ?

Thanks allready.

Cheers,
Jespar

Hi Jespar,
you could loop through your particles and get the .x and .y properties of a particle. Those could be used to position an object then. There is now way to follow a "line" of particles, because there is no global path calculated for all particles at once. Each particle is updated individually, so you have to pick an individual particle and check it's position.

Could you please describe in detail what you are trying to achieve? Maybe there is a better (and faster) solution for that.

HI,

Thanks already for answering my topic.

My goal to archief is the following and fairly simple in the mind:

1. User swipe's a new (particle) path with his finger

- Start location PLAYER (sprite)
- End location somewhere on screen

2. PLAYER (sprite) follows the draw-en particle path ( needs also to rotate if there's a curve in the path off-course)

I know i can store the path of the particles, the X and the Y, but now the only thing i need is the rotation of the player sprite while on the path.

Resume:

Player follows a draw-en particle line on the screen and rotates when there's a curve in it.

Cheers,
Jespar

I see... hmm, I'd suggest using bezier paths and moving your images along them. Carlos posted a nice sample regarding bezier paths somewhere here in the forums. Particle Candy has not been designed to solve such special tasks, because it's main purpose is the creation of special effects like fire, flames, smoke etc. Such a feature could be added, of course, but we really have to keep performance as a primary goal in mind, so it would be a bit of overkill for such "rare" tasks.

views:1725 update:2011/10/14 9:11:21
corona forums © 2003-2011