repeat
hypotenuse_length = 1
further_sight_blocked = 0
repeat
added_x = hypotenuse_length * cos(angle_A#)
added_y = hypotenuse_length * sin(angle_A#)
if x + added_x > 0 and x + added_x < 41 and y + added_y > 0 and y + added_y < 41
selected_sprite = (((x - 1) + added_x) * 40) + (y + added_y)
if obstacle_grid[x + added_x,y + added_y] = 0
SetSpriteImage(selected_sprite,6)
endif
if obstacle_grid[x + added_x,y + added_y] = 1
further_sight_blocked = 1
endif
inc hypotenuse_length
print(ScreenFPS())
//sync()
endif
if GetRawKeyPressed(27) = 1 then end
until further_sight_blocked = 1 or x + added_x = 41 or x + added_x = 0 or y + added_y = 41 or y + added_y = 0
inc angle_A#,0.50
until angle_A# >= original_angle_A# + 90
This is the part you're talking about, I guess.
Whenever you call the sync() command it sets a timer. When you call the sync() command again the timer will stop and it will start a new timer. The amount of time that has passed when the timer has stopped it uses to calculate your fps.
So let's say 1 sec has passed it will say the fps is 1 frame per second. If you put an extra sync() command in your program you essensially higher the frame rate, because it has to do less before the next sync() command comes.
Basicly what you're doing if you don't comment out the sync() command is letting the computer do in that function is:
do
repeat
start a timer
do something really simple
stop the timer and printing it on the screen
until ...
loop
That would be almost the same as a program that did:
do
start a timer
stop the timer and print it on the screen
loop
just like the starting program you get when you open a the starter file:
do
Print( ScreenFPS() )
Sync()
loop
Concluding The fps may be higher when you use an exra sync() command in your loop, but it doesn't make your program faster, but it only stops the timer multiple times every time it loops. So what you should do is deleting all sync() command except for the sync() command in your main loop just before 'loop'.