Particle lifetime and interaction

Get help using Construct 2

Post » Fri Dec 27, 2013 5:20 pm

Hi! I wanted to use Particles as kind of item drop from an enemy. If the enemy dies, particles are created once (One-Shot, 360 cone) and then the player should be able to collect them. But it seems there are a few problems.

1. I tried to create ever lasting particles in a One-Shot but it seems this is not possible. They are destroyed after the Timeout (or faded out).
>>> Is it possible to let them stay forever somehow? (if not I will have to deal with it and let them fade out after a few secs)

2. Can you interact with parcticles somehow? I tried "When Player overlaps Particles" and "On Player Collision with Particles" >> Particles Destroy - but it seems both do not work. Can you check if particles were "touched" to collect and destroy them?

3. Is it possible to let the particles react to other objects with physics? (bounce off)

If this is not possible, does anyone know a (good) way to create a similar effect with sprites? Maybe creating sprites with bullet behaviour and random angles and slow them down over time?

regards,
Bl4ckSh33p / AlexBl4ckSh33p2013-12-27 17:24:59
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591

Post » Fri Dec 27, 2013 5:33 pm

I'm not sure spawning sprites at particles is possible, but why not just spawn the sprites you want to interact with with bullet behaviour. maybe using the particles as well to improve the look.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 27, 2013 5:36 pm

You can't interact with particles. Particles are the lowest graphical representation value. This offers the ability for high count particles and low memory cost. However then the partciles don't have enough info to be able to do anything else than be an image with an XY value.

If you need to interact with particles. Then you need to create sprites that behave like particles.
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Fri Dec 27, 2013 5:39 pm

Yes to all.

1. Set timeout to 9999
2. Give it solid behaviour then you can interact with it using those commands
3. Yep, give the particle the physics or bullet behaviour

Sprites are easier but I guess use Particles if you want some elaborate animation.plinkie2013-12-27 17:40:20
B
47
S
18
G
84
Posts: 2,265
Reputation: 49,784

Post » Fri Dec 27, 2013 6:10 pm

I didn't want to spawn sprites at particles, but this is an interesting idea. ;)

Thank for the hint with behaviors!
I added the "Solid" Behavior and "On Collision" worked, BUT when I hit a particle all particles were deleted, not the ones I hit. So it seems you cant handle every particle as its own object?

Since the particles "explode" with x pixel per sec and a -y deceleration they stop after a while and fly backwards. So I have to "kill" them before this happens - or do you know a workaround for this as well?Bl4ckSh33p2013-12-27 18:11:53
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591

Post » Fri Dec 27, 2013 9:01 pm

make your own particles function - something like

https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/fnparticles.capx

in this quick example click the left mouse to create 8 sprites at the players location -

just call the function with param(0) and param(1) being the location where the sprites will appear. Param(2) is the number of boxes. the boxes will spread out over 360 deg. alter family bullet behaviour for different effects. You could always add real particles/ rotation/ resize to make it flasher

RamPackWobble2013-12-27 21:04:42
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Fri Dec 27, 2013 9:17 pm

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sat Dec 28, 2013 6:28 am

Thank you very much for sharing your examples!
This will help me a lot.

PS: @plinkie: When you set the particles to solid I noticed there is an invisible square you can run into.
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591

Post » Sat Dec 28, 2013 7:00 am

Yeah I doubt you can specify each particle separately. I'm sure you can do what you want to do with sprites. Is the particle animation that important to the game?

You can't set up collision for particles so I guess it depends on the image you used.
B
47
S
18
G
84
Posts: 2,265
Reputation: 49,784

Post » Sat Dec 28, 2013 7:54 am

The particle animation is not so important, it was just a nice way to "spread out" a few small dots and I wanted them to be collectable as kind of powerup/healing item for the player. The example from RamPackWobble above does the same with sprites and I will use a variant of this. Bl4ckSh33p2013-12-28 07:54:52
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest