# Missed stuff out of my capacity...

Bugs will be moved here once resolved.

### » Thu Sep 29, 2011 6:50 pm

I tried using the Scrolling Tiled BG example from here:

http://www.scirra.com/forum/scrolling-tiled-background-c2_topic44823.html

In my project, and failed.

I could fix it myself, but "60 * dt" and "* -1" are coding terms beyond my understanding... so i'm afraid it would be wiser to just ask for help.

so...

Help?

http://db.tt/n1MfSLc1
B
4
S
1
G
1
Posts: 39
Reputation: 840

### » Thu Sep 29, 2011 6:58 pm

* -1 is just some math to flip the sign of a number.

100 * -1 = -100 (negative of the original positive number)
-100 * -1 = 100 (positive of the original negative number)

dt is the time in seconds since the last tick - "delta time". 60 * dt means 60 times a second, no matter the framerate. So if you add 60 * dt to an object's X position every tick, it moves right at 60 pixels per second, no matter the framerate.
Scirra Founder
B
414
S
245
G
92
Posts: 25,205
Reputation: 200,351

### » Thu Sep 29, 2011 7:03 pm

Holly cows...

Well, I'm still trying to understand some parts of what you said, but thanks.

I'll see if i can put them to good use later. ^^
B
4
S
1
G
1
Posts: 39
Reputation: 840

### » Thu Sep 29, 2011 7:04 pm

This article might help. It's for Construct Classic, but the concept is the same. Note the 'timedelta' expression is equivalent to C2's dt.
Scirra Founder
B
414
S
245
G
92
Posts: 25,205
Reputation: 200,351

### » Thu Sep 29, 2011 7:33 pm

Ok. Thanks a lot! ^^
B
4
S
1
G
1
Posts: 39
Reputation: 840

### » Thu Sep 29, 2011 8:07 pm

Your monitor typically runs at 60Hz or 75Hz. These are considered to be ideal refresh rates for your eyes not to notice any transition between frames. That means you are shown 60 or 75 pictures per second.

Timedelta or dt is the time between two consequent frames. How much time does it take before the next frame is shown?

You could simply calculate 1/60 = 0,0166666... or 16,7 milliseconds, however in reality, the computer doesn't always render them exactly at that time. Sometimes it takes longer (particularly intensive processing), sometimes it takes shorter (black screen, nothing to draw), so timedelta can differ.

So, Construct remembers how long it took to draw a frame, the time since last frame. That value is timedelta. You can use this value for a lot of stuff, like precise movement.

For example, if you move 2 pixels right after each frame (which "Always" or "On every tick" does), it won't move at the same speed if the game runs at 30 FPS (frames per seconds); because the frames are shown half as often, the dot moves half as slow, too. Likewise, if you are rendering at 120 FPS, it will move twice as fast.

That effect is often undesirable, so instead you use timedelta. By multiplying the desired speed with timedelta value, you get exactly how much you need it to move each frame, so it will always move at the same speed even if your game slows down or speeds up.

I hope that helped!
B
62
S
21
G
13
Posts: 1,910
Reputation: 13,685

### » Thu Sep 29, 2011 8:10 pm

Helped a lot. Thanks. ^^
B
4
S
1
G
1
Posts: 39
Reputation: 840