playMaker

Author Topic: How do I create and destroy exploding particles in Playmaker?  (Read 1435 times)

alextm2997

  • Playmaker Newbie
  • *
  • Posts: 3
Hello, for my 2D RPG game, I'm trying to make an exploding particle effect appear after destroying an object like a pot.

After the pot gets destroyed, the particles should be created, appear for 1 second and then get destroyed as well. I can't put them in the same code as the 'Destroy' state, or else the particles won't appear in time.

What is the most effective method of creating an explosion effect in Playmaker for an object that gets destroyed?

Any help will be greatly appreciated.

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: How do I create and destroy exploding particles in Playmaker?
« Reply #1 on: July 30, 2020, 08:06:50 AM »
First of all, you should be doing a Pool instead of instantiating. This will reuse objects pre-loaded into your scene rather than creating new objects every time. This is better for performance.

Second, when you need the particle to appear, you get the position it is to be at, then you spawn them on that position. So for example it may be the location that the projectile is on when it impacts, or the position of the object that gets hit, etc.

On the particle have an FSM which does a simple Wait (giving enough time for the effect to finish) then do the destroy back to pool.

Find the Pooler on the ecosystem.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: How do I create and destroy exploding particles in Playmaker?
« Reply #2 on: July 30, 2020, 06:09:35 PM »
Hi.
For particle end, there are some actions on the Ecosystem For example :
Particle System Is Alive and Particle System Multi Is Alive .

alextm2997

  • Playmaker Newbie
  • *
  • Posts: 3
Re: How do I create and destroy exploding particles in Playmaker?
« Reply #3 on: August 04, 2020, 04:18:05 AM »
First of all, you should be doing a Pool instead of instantiating. This will reuse objects pre-loaded into your scene rather than creating new objects every time. This is better for performance.

Second, when you need the particle to appear, you get the position it is to be at, then you spawn them on that position. So for example it may be the location that the projectile is on when it impacts, or the position of the object that gets hit, etc.

On the particle have an FSM which does a simple Wait (giving enough time for the effect to finish) then do the destroy back to pool.

Find the Pooler on the ecosystem.

Thank you for the response, the explosion particles do appear now, but now I have another issue.

I want to make an FSM for the particles prefab which should detect the number of objects in the level with the tag "breakable" and spawn that number of explosion particles in the pool. Then I want the explosion particles to appear when one of the breakable objects gets destroyed. It should somehow detect if a pot gets destroyed and then send one of the explosion particles to the position of the destroyed pot, play the explosion and then destroy itself. This should repeat until there are no more breakable objects in the level.

How do I achieve something like this?

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: How do I create and destroy exploding particles in Playmaker?
« Reply #4 on: August 04, 2020, 05:41:27 AM »
Since you should pool the pot instead of destroying it, you will then disable it.

There is a convenient SYSTEM transition event that can allow you to do things in the end of a game object's last frame of activity as it's being deactivated.
It's SYSTEM / DISABLE. If used as a global transition, it's fired up automatically in the FSM as the GO is being deactivated.

This allows you to run a bunch of simple processes, but they must all be achieved within this one, last and single frame.

As for the latter request, you have two options:

One pool for pots that have their associated particle systems, or two pools, one of the pots, another one for the particles.