Particle Question

  • #1, by omri-gilatFriday, 10. July 2020, 00:05 4 years ago
    Hi All,

    Trying to get the hang of particles...
    What I want to achieve is to show a particle system (small explosion effect) on the main character (or on a different character) and to make it loop once every time an achievement is completed.
    I was able to create the effect in the particle tab but the only way I found to make it run is by adding it as a component to a scene, but then it runs endlessly whenver I enter that scene.
    So - Maybe someone can point me in the right direction of:
    1. How to make it loop once upon a certain action/condition
    2. How to make the particle system's center be where the character is standing (and not at a fixed point on the screen).
    Any help will be much appreciated.
    Thanks in advance!

    Newbie

    3 Posts


  • #2, by SimonSFriday, 17. July 2020, 09:19 4 years ago
    Hi,
    you could try using the emitter loops for that. You would need to hide the particle system until first time. Set the emitter loops to 1.

    So at the start:
    loops = 0

    And then with every interaction:

    local p = graphics.getParticles(game.CurrentScene.Objects["effect"])
    loops = loops + 1
    p.loops = loops
    local pos = game.CurrentCharacter.Position
    p.center = {pos.x,pos.y}

    Thread Captain

    1581 Posts