• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to change the speed of all objects to make a slow motion effect?

jakaloy

Member
I've tried to use this simple code:
GML:
with(all)
{
    speed=speed*global.slow
    path_speed=path_speed*global.slow
}
The problem arises with objects, where speed is set only one time, for example, bullets, which means their speed is gonna get halved until they are not moving at all. But if I set this code, so it will only get executed at the beginning of the slow motion, objects where speed is repeatedly restarted, for example, enemies that use mp grid pathfinding, won't get affected at all. What would be the best solution besides going to every speed variable and adding *global.slow?
 

TheouAegis

Member
Close, in every object, when it sets its own speed, multiply that speed by global.Slow. Make sure your variable has a default value of 1.
 

drandula

Member
You could also check 'delta timing' in general.
Calculations are more complicated if things are acceraleting and game speed is changing. Just to reminding that, I can't give long answer now.
 

jakaloy

Member
Close, in every object, when it sets its own speed, multiply that speed by global.Slow. Make sure your variable has a default value of 1.
I expected that I'll have to do this, but I was hoping to find an easier way since I have a lot of objects and it will take some time to go through all the code.
 
Top