GMS 2 can I slow down particles?

Discussion in 'Programming' started by Mr Errorz, Apr 15, 2019.

  1. Mr Errorz

    Mr Errorz Member

    Joined:
    Jun 21, 2016
    Posts:
    217
    I am using the built in particle system, and I have particles moving at a certain (and constant) speed,
    I want to start decreasing the particles' speed at a certain point (not from the moment of creation), is that possible?
     
  2. jackquake

    jackquake Member

    Joined:
    Aug 17, 2016
    Posts:
    81
    Not that I'm aware. However, when thinking of a fireworks particle system, at the end of the life of one particle (the lift-off), another one is activated (the burst). Perhaps you could create the same particle effect with a different speed at the end of its life. Hopefully this makes sense.
     
  3. samspade

    samspade Member

    Joined:
    Feb 26, 2017
    Posts:
    2,023
    Yes. You need to take over the automatic updating of the event though and remember that you can only do it in whole steps.

    This is my version of it using delta time.

    Code:
    
    #region //get delta
    var _delta_time = DELTA_TIME;
    var _gameplay_delta_time = GAMEPLAY_DELTA_TIME;
    #endregion
    
    
    #region //update particle system
    counter += 1 * _gameplay_delta_time;
    if (counter >= 1) {
         var counter_int = floor(counter);
         repeat (counter_int) {
             part_system_update(particle_system_layer);
         }
         counter -= counter_int;
    }
    #endregion
    
    
    
    With some obvious missing pieces. Essentially, just disable the automatic updating then add a counter. Update the counter by 1 * slow_down where slow_down is a number between 0-1. The closer to 0 the slower it will update. This will also work to speed up the system. If you know that you will never do that, then you can lose the repeat which is there to handle an increase in speed.
     
    Mr Errorz and jackquake like this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice