I’ve made an extension which allows Delta Time to be in blocks! This is a useful extension because you can take the delta block and multiply something a value by it, and if your project has a low framerate, or if you just want it to work well on hardware/mobile devices, objects will move at normal speeds instead of slow motion.
Here’s the extension: https://github.com/kiwiphoenix364/pxt-deltatime
Paste this into the search bar of the extensions page on the editor and click the extension that comes up. Then your block should be added. Also, @UnsignedArduino, it’s your choice whether you want to or not, but you could add it to your “Awesome Arcade Extensions” Github page.
Could you give an example on how to use this? Little confused on what the delta block actually represents. Milliseconds since last frame?
If the gap between frames is larger than normal, it will output a higher value, equivelant to if the dropped frames were there. If you set a speed or acceleration (you have to set it every frame so it detects what the delta variable is every frame) to " * delta", then if frames are dropped, the delta time variable will account for that.
I tried to make an example, but it doesn’t seem to work lol
Could you help me fix it? I’ll add it to the list once I get an example for this.
Sorry, I didn’t have the math right… I got it right now, and you can see very well here how it works:
You can change how laggy it is with the up and down arrows. The bottom one moves the same speed, no matter the framerate. You can also use the top one for reference, as it does not have delta applied to it. The multiplier level is below, the number of times the top one has gone across the screen is in the life counter, and the score counter shows how many times the bottom one has gone across the screen. Sorry I had the extension messed up before…
I’ve made a new demo (no updates to the extension, I’ve just made the demo more “usable”)
whats Deltatime (This guy is dum)
I explained it briefly in the demo above, but what deltatime does is it tells the time in-between frames. This extension takes that time and makes it so that moving objects ignore frame drops, so for example if there are half the frames in a second, an object will go the same distance as if the game had full fps. (You can multiply a value by (like in a set velocity block you would do set “velocity = [velocity] * delta”) the new variable in the next for it to compensate for frame drops) This can be useful for slow projects or stuff on hardware that has a low fps.