Page 1 of 1

Game breaks in love.js compatibility mode

Posted: Tue Mar 12, 2024 3:40 am
by mako
Game is attached. I've tested on both Chrome and Firefox.

The game runs for about 1-5 seconds before crashing. It looks like everything loads correctly, but then I get a Lua error in the console that doesn't normally break in a desktop version of LÖVE.

Anyone know why this might be happening?

Re: Game breaks in love.js compatibility mode

Posted: Sun Mar 17, 2024 8:51 pm
by mako
Fixed it, it was user error. Admittedly, the OP was extremely vague.

The error is that a quad was nil when running love.graphics.draw, but only sometimes. This is due to how my animation module works, which flips through the quads I need to use based on a frame number that increments by love.timer.getDelta every frame. The result is floored, which gives me an index for the quad I need to draw with that frame.

The problem happened because sometimes, and only on in love.js, that frame counter would go out of range for a single frame because I used > instead of >= for my out of range check. This caused the quad to be nil and an error to be thrown.

Why this happens on love.js but not on desktop I don't know, but thankfully it's fixed now and I don't need to worry about it being some obscure engine bug. :P