How do I use delta time correctly

Get help using Construct 2

Post » Fri Jul 18, 2014 11:41 am

I've read this tutorial: https://www.scirra.com/tutorials/67/del ... dependence

Am I using dt correctly here:

Image

?


Thanks :)
Black Bobby The Hole Greenlit with 303 votes.
B
35
S
8
G
1
Posts: 163
Reputation: 2,979

Post » Fri Jul 18, 2014 11:56 am

It seems you are using it correctly.

Basically, dt is the time per tick (in seconds per tick)

When you want to modify a value V (for exemple a distance in pixels) at a certain variation DV in unit_of_v / seconds (pixel per seconds in our exemple), since you are acting each tick, you have to apply each tick:

New_V (unit_of_V) = V (unit_of_V) + DV (unit_of_V / seconds) * dt (seconds/tick)

Basically 60*dt is an easier way of implementing it (since you won't see a difference at 60 fps, which means you are deplacing it in your case at 2 pixels per 1/60 seconds, which is considered the normal tick)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Fri Jul 18, 2014 12:53 pm

@Aphrodite thanks for the explanation :) I was unsure if it was actually doing it what I wanted it to do :lol:
Black Bobby The Hole Greenlit with 303 votes.
B
35
S
8
G
1
Posts: 163
Reputation: 2,979


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests