Particle angle based on direction of travel?

For questions about using Classic.

Post » Fri Feb 12, 2010 8:57 am

Hello, everybody!

After a longer pause decided to try some game-making activity again and while looking at the available options Construct seemed like the best choice. Totally paying off so far (even if there's MUCH to learn). :)

But onto the question - perhaps I'm missing something, but is there a way to have particle system particles have same angle as their travel direction? Currently it looks like this (let's pretend that the black arrow is our particle):



And this would be the desired result:



Also - is there a way to randomize the hue of each particle?

If neither is both would be GREAT new features to add to the particle system.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Fri Feb 12, 2010 11:14 am

[quote="Somebody":ugwzob83]And this would be the desired result:

[/quote:ugwzob83]

Set the spray cone to 360 degrees?

[quote:ugwzob83]Also - is there a way to randomize the hue of each particle?[/quote:ugwzob83]

No, but you could layer a few different particle objects on top of each other and have different colors assigned to each one.

Or you could make your own particle sprayer using sprites. Something like so:

[code:ugwzob83]
+ Every whatever Milliseconds
+ Repeat numberOfParticles times
-> Create Sprite at X, Y
-> Set angle to random(360)
-> Set speed to random(whateverSpeed)
-> Set color filter to rgb(random(255), random(255), random(255))
[/code:ugwzob83]

If you use Bullet and Fade behaviors on them then they will move and fade out on their own.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Feb 12, 2010 11:34 am

[quote="deadeye":29z0c7wh]Set the spray cone to 360 degrees?[/quote:29z0c7wh]

Thanks for the reply! I understand the movement of the particles just fine, here's an example of the problem:

Let's say I want to do some impact sparks - sparks usually travel fast and thus look like lines instead of dots. So I pick a texture like this:



Now the result in Construct looks like this (note how they all just stay the same - and random rotation wouldn't help here either):



But it would be awesome to have each particle turn the direction of its movement, like this:



[quote="deadeye":29z0c7wh]Or you could make your own particle sprayer using sprites. Something like so:[/quote:29z0c7wh]

Yeah, was considering it, but that seems a little wasteful on resources, I bet a dedicated particle system is faster. Already using something like that for missile trails, for example.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Fri Feb 12, 2010 12:01 pm

Ah, I see. No, the particles don't angle themselves like that.

[quote="Somebody":4xx1t9iv]Yeah, was considering it, but that seems a little wasteful on resources, I bet a dedicated particle system is faster. Already using something like that for missile trails, for example.[/quote:4xx1t9iv]

True, it's not as efficient as particles, but as long as you don't have thousands of sparks on the screen at once it should be okay. And you could easily get that angling thing you're after with sprites.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Feb 12, 2010 12:48 pm

Ok, will have to try it with sprites then. Thanks for the code sample.

Also sounds like something for the suggestion topic - since this rotation thing is quite common in most particle systems and quite handy too.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests