Sprite.SetFrameRate

OpenTuring

Sprite.SetFrameRatePart of Sprite module

Syntax   Sprite.SetFrameRate (framesPerSec : int)

Description   Specifies the maximum number of times per second that sprite positions will be changed on the screen. The higher the number, the smoother the animation will appear (and the more processor time will be used to perform the animation).
Details   When you change the position or appearance of a sprite, Turing does not update the window immediately. Instead, it waits a certain length of time and then updates all sprites that have moved since the last update. This allows for relatively smooth animation.

This means that you have a simple loop that calls Sprite.SetPosition 200 times a second, the image of the sprite on the screen is still only being moved (by default) 33 times a second.

You can specify how many times a second Turing checks to see if a sprite has moved by using the Sprite.SetFrameRate procedure. Rates of 5-10 will make the movement of the sprites seem very choppy. Rates of 100 are more or less completely smooth (the maximum is 120) and most CRT's will not notice any difference after 60. The default rate is 33 frames per second. You should note that if you set the rate higher than your computer can handle, every other part of your program will slow down as Turing will be checking for sprite movement rather than executing your program.

A modern PC (2+ GHz with a decent graphics card) can probably handle a frame rate of 60+, depending on the number of sprites. A Pentium III should probably use the default rate. Slower machines should probably use a lower rate (around 20). Experimentation is the best way to determine the ideal frame rate.

Status   Exported qualified.

This means that you can only call the function by calling Sprite.SetFrameRate, not by calling SetFrameRate.