Hell there! I'm currently working on my own battle system, one that can make battles on the map itself. I'm currently using common as I'm not the brightest with JavaScript as of now.
Anyway, the idea here is that it checks which players or enemies are active, puts them in an array with a certain value so their corresponding switches can be triggered later, and then it would reorganize the order of the values based on their speed.
So far, the first two points are working properly, but the last part where it reorganizes the values is the one where I'm having trouble with. I'm using a selection sort algorithm (I was referencing this for those who are curious) made in events to do all of this, but for some strange reason, whenever the game runs and it goes to the sorting part, it freezes the game. It doesn't give me an error nor does the console in the DevTools give me an error; it just flat out freezes. I can't if it's lagging so hard because of the events I laid out, or if I'm doing something wrong. But nevertheless, I could use some feedback.
If there's any feedback that you can give me or any other alternative to this, I would love to know. Thank you!
Anyway, the idea here is that it checks which players or enemies are active, puts them in an array with a certain value so their corresponding switches can be triggered later, and then it would reorganize the order of the values based on their speed.
So far, the first two points are working properly, but the last part where it reorganizes the values is the one where I'm having trouble with. I'm using a selection sort algorithm (I was referencing this for those who are curious) made in events to do all of this, but for some strange reason, whenever the game runs and it goes to the sorting part, it freezes the game. It doesn't give me an error nor does the console in the DevTools give me an error; it just flat out freezes. I can't if it's lagging so hard because of the events I laid out, or if I'm doing something wrong. But nevertheless, I could use some feedback.
If there's any feedback that you can give me or any other alternative to this, I would love to know. Thank you!