Game breaks in love.js compatibility mode

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
mako
Prole
Posts: 2
Joined: Tue Mar 12, 2024 3:18 am

Game breaks in love.js compatibility mode

Post 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?
Attachments
emerald.love
(1.2 MiB) Downloaded 32 times
mako
Prole
Posts: 2
Joined: Tue Mar 12, 2024 3:18 am

Re: Game breaks in love.js compatibility mode

Post 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
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 75 guests