This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-11-18 02:08:26

codeblue
New Scratcher
Registered: 2010-07-13
Posts: 11

What FPS does scratch operate at?

I'm currently working on a projectile motion game in scratch, and I'm wondering how it works when it comes to frames. Does scratch keep a constant FPS? If not, is there a way to implement an accurate deltatime approach to this problem? I have only been able to get a deltatime between frame of .1 seconds. I hope someone can help me with this! Thanks!

Offline

 

#2 2012-11-18 05:18:32

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: What FPS does scratch operate at?

I don't think it has a set framerate. Every single image-manipulative block is done completely, before it moves onto the next block (I'm pretty sure, although I could be wrong since I don't see the source of scratch a lot).

If you want to be able to control the frame rate, you could just have all the rendering scripts run at around the same time (you would need to have either a bunch of broadcast and wait's running in sequence, or just a 1 sprite 1 script project), and to slow it down put wait blocks.

Offline

 

#3 2012-11-18 15:10:47

codeblue
New Scratcher
Registered: 2010-07-13
Posts: 11

Re: What FPS does scratch operate at?

I'd imagine that could get buggy.. Normally what is done in programming if the update isn't set you get the change in time between two frames then multiply the movement of an object by that time to keep it consistent, but the timer only keeps track out to on decimal point of accuracy. I need three decimal points for this method to work. Any ideas of how to get more accuracy in measurements?
Thanks,
Cody

Offline

 

#4 2012-11-18 15:31:22

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: What FPS does scratch operate at?

codeblue wrote:

I'd imagine that could get buggy.. Normally what is done in programming if the update isn't set you get the change in time between two frames then multiply the movement of an object by that time to keep it consistent, but the timer only keeps track out to on decimal point of accuracy. I need three decimal points for this method to work. Any ideas of how to get more accuracy in measurements?
Thanks,
Cody

Instead of using Scratch's timer, you could create an artificial timer, though this isn't too much more accurate. In fact, it's only accurate to the fortieth of a second. Anyway, here's the script for the artificial timer:

when gf clicked
set [timer v] to (0)
forever
 change [timer v] by (.025)
I hope that this helps!

Last edited by ErnieParke (2012-11-18 15:34:06)


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2012-11-18 15:39:51

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: What FPS does scratch operate at?

codeblue wrote:

I'd imagine that could get buggy.. Normally what is done in programming if the update isn't set you get the change in time between two frames then multiply the movement of an object by that time to keep it consistent, but the timer only keeps track out to on decimal point of accuracy. I need three decimal points for this method to work. Any ideas of how to get more accuracy in measurements?
Thanks,
Cody

Actually, the timer goes out towards the third decimal place, it only shows towards the first decimal place in the displayer, but if you put it in a list display, it goes until the third decimal, and the timer reporter will report in the third decimal. So your way can work.

Offline

 

#6 2012-11-18 16:48:59

muppetds
Scratcher
Registered: 2011-02-11
Posts: 1000+

Re: What FPS does scratch operate at?

remember that scratch takes 0.2 seconds to process a block btw


SCRATCH'S PARTLY INSANE RESIDENT 
http://internetometer.com/imagesmall/31691.pnghttp://bluetetrarpg.x10.mx/usercard/?name=muppetds

Offline

 

#7 2012-11-18 20:10:16

Nathanator1416J
Scratcher
Registered: 2012-02-21
Posts: 100+

Re: What FPS does scratch operate at?

On average, of course!


http://wiki.scratch.mit.edu/images/Ptp.gif PEPPERTREE  Productions (PtP)
Tourmaline Scientific Research Programs

Offline

 

#8 2012-11-21 16:26:16

codeblue
New Scratcher
Registered: 2010-07-13
Posts: 11

Re: What FPS does scratch operate at?

Thanks everyone for your replies. Apparently the fps implementation will not work in scratch for whatever reason. I have conceded to a fall back method where I simply calculate the position of the object based on the formulas of newtons law of motion instead of incrementing the acceleration every frame. Thanks again for your input!

Offline

 

#9 2012-11-22 04:23:59

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: What FPS does scratch operate at?

Were you talking about using Euler's method for integration? I made a project that uses integration to calculate the position of a projectile, which worked OK. I'll post the script if you want.


Be nice, I'm an old lady  wink

Offline

 

Board footer