###

» Sat May 14, 2011 6:18 pm

[quote="Arima":3tmazibc]No, no, use Door.Y-(100*timedelta).[/quote:3tmazibc]

I may misunderstand this, but if you mean the parentheses I should say that they are not needed in the example. Construct follows the mathematical rules of order for arithmetic operations. Multiplication and division has higher priority than addition and substraction.

Door.Y - 100 * TimeDelta

Door.Y - TimeDelta * 100

Door.Y - (100 * TimeDelta)

All three do exactly the same. First multiplying 100 with TimeDelta (or TimeDelta with 100, which doesn't make a difference in multiplication), then substracting the result from Door.Y.

[quote="Azu":3tmazibc]I tired it and I really don't like it. I tired Door.Y-0.25*timedelta and it move super slow, like 0.25 every second. I had to do like Door.Y-100*timedelta. I'm not use to using big numbers. I really know nothing about timedelta because I never used it.[/quote:3tmazibc]

Like PixelRebirth said, don't think in fractions but in the resulting period. If you aim for your game to run at 60 fps and add 1 pixel per frame, then the effective pixel rate is 60 * 1 = 60 pixels per second. And value * TimeDelta simply means "that much of value per second" (and Construct cares about how much of that needs to be used per frame). So, when your game would run constantly with 60 fps, then

[code:3tmazibc]+Always

-> Set x to x + 1[/code:3tmazibc]

and

[code:3tmazibc]+ Always

-> Set x to x + 60 * TimeDelta[/code:3tmazibc]

do the same. But if the framerate changes, then the second event makes sure, the speed is still constant 60 pixel per second.

TimeDelta is a number that expresses the time passed between the current and the last tick. On a system where there is constant 60 fps, TimeDelta will be 1/60 (or 0.016p) on every tick. Now multiply 60 with 0.016p. Yeah, it's 1, just as wanted and expected.

Of course, TimeDelta serves as an indicator for all changes and hickups in the framerate, not only a constant change. And that's what makes it so flexible and guarantees a constant line of whatever you need (movement, speed, rotation, color fade, etc.) over time, by using higher or lower portions per frame to compensate.