So I'm developing the SRPG Engine plugin and one of the functions requires quite a long time to run(about 500ms). While running that function, all the sprites will stop updating, and the screen freeze. The function is about AI moving and targeting, which includes complex route searching, tile evaluation, and target evaluation, so it can be very slow when a battler has a lot of large range AoE skills and high mobility.
To simplify the situation, say you have a function like this, and it's triggered by an event:
After you trigger this event, the game will freeze for about 0.5s.
Is there a way to update sprites after each inner loop?
I already tried SceneManager.updateScene(), and some other methods to update the sprites, they won't work.
I feel like updating the frame is controlled by the window object, but I have no idea how to force it to update the frame.
Thank you for you help in advance.
To simplify the situation, say you have a function like this, and it's triggered by an event:
JavaScript:
var sample = function(){
for (var i = 0; i< 20; i++){
for (var j = 0; j < 100000; j ++){
var dosomething = 'dosomething' //dosomething...
}
//I want to put some code here to update sprites.
}
}
Is there a way to update sprites after each inner loop?
I already tried SceneManager.updateScene(), and some other methods to update the sprites, they won't work.
I feel like updating the frame is controlled by the window object, but I have no idea how to force it to update the frame.
Thank you for you help in advance.