No. For any values of Sleep(
x) - number of Keyboard.IsKeyDown() calls are CONSTANT. But real speed of sprite moving is DIFFERENT. For my code calls value is
174. Because in my script sprite path on Y-axis has limit of 870 px. If sprite moves with Y=Y+5 increments then 870px/5px = 174 times (
I've checked it very carefully - when I changed in script Y-axis increment to +10 number of Keyboard.IsKeyDown() calls has decreased to 87). I don't understand why it works this way
.
This is very strange problem for me - if number of keyboard calls are constant in both cases and FPS under forced control (vsync on/off, FPS 60/400) then logically
smoothness of the animation must change only, but NOT the time period of sprite moving for gamer's eyes (if I call keyboard and increase Y=Y+5
174 times per REAL second - my sprite must achieve bottom of the screen in one second in ALL CASES). And for these FPS values (60/400) I shall not see any visible difference in speed and smoothness down to FPS value equal 30 and less (approximately eyesight limit for animation).
Moreover internal animation cycle in any sprite entity works CORRECTLY with dependency on REAL TIME msec delays between its frames.
I think correct way is:
I changed sprite Y position - if engine has time to render frame with current sprite position smoothly- it will render (acceptable FPS > 30), if has not - engine should calculate sprite in the next position but frame will not be rendered correctly for your eyes due to video hardware limitations (not acceptable FPS < 30) , therefore animation flickering will appear.
In WME real time sprite moving speed is decreasing proportionally to FPS fall (sleep() delays too but it is reasonable)
But I mean situation only when sprite controlled by gamer with cycled keyboard state checking.
Within any sprite entity internal frames animation renders correctly without explicit fps dependency.
It means obviously that WME internal time ticker synchronized to fixed reference FPS value as base of engine synchronization - may be equal 60 or another fixed value but NOT to REAL TIME? Therefore all processes within engine depend on this base reference FPS value?
Can be that any external script executed by engine (especially event handlers) cannot be synchronized to real time?
In this case how to make laser shot sprite? Or energy ball sprite with fast moving over screen? (without large coordinates increment because it will lose smothness)?