Would it be possible to include a block that would force Arcade to redraw the screen? Or even a JavaScript command, like game.update_screen()
? So we don’t have to include pause(100)
whenever we want to update the screen, like during a resource-intensive function that’s displaying a progress bar. (For me, that’s calculating 20 different paths over a 64x12 tilemap using Joey’s A* extension. It’s actually pretty slow when the tilemap is that big, which is understandable.) Or will even calling pause (1)
update the screen?
When I used sprites and stuff I think pause(0) or pause(1) worked but that was a while ago. I could be wrong.
Maybe you can explain what you are trying to achieve? I don’t quite understand why you would pause just to update the screen, since the screen IS being updated every few milliseconds. The amount of time between a ‘game update’ is not fixed, as that is dependent upon the hardware and sprites and events it has to process, but in each ‘update’ of the scene, the following occurs:
If you have a resource intensive function running that doesn’t have any delays in it, the screen won’t update unless I put in a delay. For example, I manually draw a progress bar to track it. If I don’t put in the delay, it goes from 0 to 100 after 20 seconds instantly. If I put in a delay, it goes smoothly from 0 to 100 after around 25 seconds.
You could use a status bar like this.
I think the default value of the status bar is 100, and every 100 milliseconds I change the value by -1. This should mean that the game ends after approximately 10 seconds.
The problem isn’t the status bar - my drawing routines aren’t being called (which is a draw on z index
handler in Joey’s sprite utilities) during my resource intensive function, unless I put in a delay between each step of the function.
And my status bar ain’t cosmetic.
Hmm. Why does it take an extra 5 secs
I’ve checked the time difference and it actually takes around 10 seconds with the delays and 7 seconds without the delays. (Moved the code around and benchmarked it) This is because I have 3000 ms delay split over 30 iterations. (100 ms per sprite) Arcade takes this time in between to update the screen.
I know there is an extension for running code in the background. Could that help here?
It’s called Timers
, and it shaved off 1 second. (9 seconds left!!!)
pause(50)
and pause(20)
also work but there is not difference under 50
ms. (7.5 seconds!)