Missed stuff out of my capacity...

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I tried using the Scrolling Tiled BG example from here:

    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?

    db.tt/n1MfSLc1

  • * -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.

  • <img src="smileys/smiley29.gif" border="0" align="middle" />

    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. ^^

  • 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.

  • Ok. Thanks a lot! ^^

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

  • Helped a lot. Thanks. ^^

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)