[Solved] Reduce particle

  • #1, by TinTinTuesday, 24. April 2018, 18:29 4 years ago
    Hi. How can reduce particle into the game slowly and put out? like raining to stop

    Forum Fan

    195 Posts


  • #2, by SimonSWednesday, 25. April 2018, 00:18 4 years ago
    That's more complex:

    emitter = 10.0
    
    startTween("emitter", 10.0, 0.1, 10000, easeLinearIn)
    
    
    
    function onMainLoop()
    
    graphics.getParticles(game.CurrentScene.Objects.object).numberOfEmitted = {0.0,emitter}
    
    if emitter <= 0.1001 then
    
    unregisterEventHandler("mainLoop", "onMainLoop")
    
    end
    
    end
    
    
    
    registerEventHandler("mainLoop", "onMainLoop") 
    

    Thread Captain

    1494 Posts

  • #3, by TinTinWednesday, 25. April 2018, 09:21 4 years ago
    Thanks Simon.  Unfortunately it doesn't work for me. Or I'm somethings wrong 

    Forum Fan

    195 Posts

  • #4, by SimonSWednesday, 25. April 2018, 10:56 4 years ago
    You need to change this: game.CurrentScene.Objects.object to your object,

    And the forum puts a <;= in there that should be <=

    Thread Captain

    1494 Posts

  • #5, by afrlmeWednesday, 25. April 2018, 13:02 4 years ago
    Simon you can fix the issue with the code blocks by editing your post afterwards & just hitting the save button without changing it. It seems to correctly display the code block as intended, but if you edit again then it will likely insert the semi-colons again, so it's a case of rinse & repeat until it removes them - code blocks have always been a pain on the VS forum in one form or another.

    Imperator

    7052 Posts

  • #6, by TinTinWednesday, 25. April 2018, 17:44 4 years ago
    Thanks a lot Simon. It works perfectly

    Forum Fan

    195 Posts