Hey, I've made this small program attempting to show the average fps, but it doesn't work, and I can't find WHY it won't work. The value of avg# seems to start a 0 and works it's way up, never quite reaching the actual fps.
sync on:sync rate 0
make object cube 1,1
do
fps = screen fps()
avg# = avg#*total#
total# = total# + 1.0
avg# = avg# + fps
avg# = avg#/total#
text 0,0,str$( fps )
text 0,15,str$( avg# )
text 0,30,str$( total# )
sync
loop
remstart
first loop
fps = 50
avg# = 0*0 = 0
total = 0 + 1 = 1
avg# = 0 + 50 = 50
avg# = 50/1 = 50
second loop
fps = 50
avg# = 50 * 1 = 50
total = 1 + 1 = 2
avg# = 50 + 50 = 100
avg#= 100/2 = 50
third loop
fps = 20
avg# = 50 * 2 = 100
total = 2 + 1 = 3
avg# = 100+20 = 120
avg# = 120/3 = 40
remend
I'm not really fussed about this code, but it's nagging me :p If someone could point out the problem, i'd be grateful
Thanks