|
Post by eyfenna on Aug 22, 2019 10:41:15 GMT -6
Heya,
if someone struggles like me with timer, getting a good rate of pictures that looks fluid here is a small function that might be helpful to put at the top of the coding file:
dim currtime
function timing(increaser) timenow = (timer - currtime)*increaser currtim = timer return timenow end function
what happens in the function basically an older value of currtime is substracted from the current runtime of the program. Tthe outcome is multiplied with increaser and stored in timenow. Tthen currtime is updated to the current runtime of the program for the next function call and the timenow is handed to the.
What happens when timing(increaser) is called at the beginning of a game loop: - the time the program has run minus the last time the function has been called is returned to a varible
- the current time the program has run is stored in the background in currtime
This function is pretty usefull for simple sprite animation demos to test things out and if the otucome of drawings looks as it should.
|
|