Problem camera when running on Windows

Hello, I developed this little game at school with p5js and P5playJS libraries. The game works globally fine but I got many bug reports from people trying to running it with a Windows computer :

The camera doesn’t follow the sprite. Each sprite is created normally and the images are displayed in the good location, but the camera initiate itself in a wrong location and stays static…
I can’t figure out if there is something wrong in our code or if there is something to know at a library level.
The bug doesn’t show up all the time, even on windows, but sometimes… and it makes the game unusable for some users so it’s a little frustrating !

There is another little bug sometimes with the music when running on Chrome, Linux or Windows.
The music starts lagging in a weird way when the track changes (like boss music, then normal music again…).

I haven’t got any feedback from Mac users so feel free to tell us if you see something else going wrong !

Here is the link of the game :

And the source code repo :
Hope you’ll have fun :slight_smile: !

1 Like

Played in Ubuntu 64bit using Chromium browser - everything seems to work fine.
I don’t think it’s an OS specific issue though.

I suggest you to temporarily add a check for some specific key like J, so that if the user presses it the game draws camera.position.x/y values right on the screen - and maybe some other values too, so that you could figure out if it’s these variables getting stuck or not - then, get someone to get this bug, press the key, and report if the values drawn change or not, to see if it’s a problem with them or something else.

1 Like

I tried the trick of reseting the camera position by pressing a key during the game. The camera updates in th right location but only for one frame (even if I keep the key down), it comes back to its stuck position immediately…
So ti get the information and it can move, but something persistent tells it to sitck itself somewhere in the map. In can’t figure out what it is… And it’s even weirder that it only happens on some Windows computer.
Could it have something to do with the machine itself ?

Hmm. What if you take the code of resetting the camera position, and just stick it right before the game starts drawing anything? This shouldn’t affect normal users if that code sets it to the right position, and should help users with the problem.

I guess it works only for one frame because you put it in void keyPressed(), which is run only once when you press a key, no matter how long you hold it. draw() is run every single frame instead.