GameMaker (all)
Icon

Steady Delta Time

Stephen Loney

You must be logged in to obtain assets

Description

Provides a persistent object that maintains consistent delta timings which can be accessed from a global variable:

global.dt_steady (variable can easily be changed to a preferred naming convention)

[Examples]

// Move right 100 pixels every 1 second
pixelsPerSecond = 100;
x += pixelsPerSecond * global.dt_steady;

// Add 2 to health each second
healthPerSecond = 2;
health = health + (healthPerSecond * global.dt_steady);

// Set number of sprite images to play per second
imagesPerSecond = 10; 
image_speed = imagesPerSecond * global.dt_steady;

// Turn 45 degrees every second
direction += 45 * global.dt_steady;

// Update seconds timer
timerSeconds += global.dt_steady;

...

Also provided is a way to set the delta time scale, allowing you to easily create global slow/fast motion effects for all values affected by delta timing.

obj_SteadyDeltaTime.scale = 0.0; // "Pause"
obj_SteadyDeltaTime.scale = 0.5; // Half speed
obj_SteadyDeltaTime.scale = 1.0; // Normal speed
obj_SteadyDeltaTime.scale = 2.0; // Double speed

Be sure to check out some of my other assets!

End User Licence Agreement (EULA).

Age Rating: 4+

Versions

GMS1 - Version 1.0.0. Published November 28, 2014

GMS2 - Version 1.1.0. Published March 9, 2018

  • Added global.dt_unsteady for "raw" timings
  • Documentation and example tweaks

GMS2.3 - Version 1.2.10. Published December 5, 2020

Improved file organisation for GMS 2.3 and updated included example.

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait