Hi splendidtank and any future readers with this same problem:
I had the exact same issue, and have identified the solution. I made a thread detailing my own experience, research, and experimentation on this problem, which can be found here:
https://forum.yoyogames.com/index.p...w_pos-silently-freezes-on-html5-target.66494/
The problem lies with the screenshake code:
Code:
//screen shake
x += random_range(-shake_remain,shake_remain);
y += random_range(-shake_remain,shake_remain);
shake_remain = max(0,shake_remain-((1/shake_length)*shake_magnitude));
When
shake_remain is 0 (as it always is when no screenshake is being applied), this code adds
random_range(-0, 0) to
x &
y. This is completely fine on all platforms... except HTML5. While on all other platforms this simply adds 0 to the
x &
y values, changing nothing and having no effect, for whatever reason HTML5 & JavaScript are unable to process this math. When -0 or whatever other funky math identifier JavsScript is using is added to the
x &
y values, and then these values are used in
camera_view_set_pos in any way, the HTML5 app freaks out, freezes, and crashes.
By simply wrapping the screenshake code in an if-statement, this can be avoided. This is a minor (almost pointlessly minor) optimization on all other platforms, but JavaScript has a history of problems with math, and needs this extra protection.
Fixed version:
Code:
if(shake_remain > 0)
{
// Screen shake
x += random_range(-shake_remain, shake_remain);
y += random_range(-shake_remain, shake_remain);
shake_remain = max(0, shake_remain - shake_magnitude / shake_length);
}
camera_set_view_pos(cam, x - view_w_half, y - view_h_half);
While this is a fixable and avoidable problem, it certainly isn't expected or desired behavior, so hopefully this math problem will be fixed in the future.