08-02-2022, 06:59 PM
@KernelPanic As I mentioned, the code *as written* has no bugs in it -- but it does, indeed, have the potential to become an endless loop. Let me illustrate how:
***
***
***
Now, imagine I print the above in _FONT 8. Font 8 is perfectly square -- 8 pixels wide, 8 pixels high.
Now, also imagine that it's centered on the screen and I decide to explode it in 8x8 boxes.
Explosion speed is calculated as the distance from the center...
How far would that 2nd * on the 2nd row be from the center??
0.0 pixels!! It is *exactly* centered, so its movement speed would become 0.
If it never moves, it'll never clear the screen, resulting in an endless loop.
As written, the code truly isn't bugged -- but it has the potential to become so with the proper data set.
If one wanted to "fix" it, the best way would be to add a line for a movement check:
IF Array(x, y).changex + Array(x, y).changey < 1 THEN .... not enough movement, do some fixing!
Then you can choose whatever method you like to fix the issue. Evaporate the block. Explode it off in a random "richotte" direction. Whatever fix floats your boat to make certain movement is always not so low that it causes insufferable program delay.
***
***
***
Now, imagine I print the above in _FONT 8. Font 8 is perfectly square -- 8 pixels wide, 8 pixels high.
Now, also imagine that it's centered on the screen and I decide to explode it in 8x8 boxes.
Explosion speed is calculated as the distance from the center...
How far would that 2nd * on the 2nd row be from the center??
0.0 pixels!! It is *exactly* centered, so its movement speed would become 0.
If it never moves, it'll never clear the screen, resulting in an endless loop.
As written, the code truly isn't bugged -- but it has the potential to become so with the proper data set.
If one wanted to "fix" it, the best way would be to add a line for a movement check:
IF Array(x, y).changex + Array(x, y).changey < 1 THEN .... not enough movement, do some fixing!
Then you can choose whatever method you like to fix the issue. Evaporate the block. Explode it off in a random "richotte" direction. Whatever fix floats your boat to make certain movement is always not so low that it causes insufferable program delay.