So I was working on a platformer game in Game Lab, when for some reason the camera stopped working when I ran the code. I had been programming it all day and it worked fine until then. I did some tests and found that if I don't run my camera positioning function (which sets the camera coordinates to be the same as the player coordinates), then camera.x and .y return NaN. If I do run the function, then camera.x and .y return the correct coordinates, but the camera still doesn't move. It stays at 200 x 200 even when the coordinates are something else.

Any ideas? Has this been happening to anyone else?

So.... let's just say that the camera is like really.... really.... weird and very temperamental so much so by simply redefining a predefined width and height values within a program will instantly fuck up the camera because the values are no longer readable apparently 🤷‍♂️ by removing lines 19 & 20 will allow the program to function as intended
here's a demo link: https://studio.code.org/projects/gamelab/vF3AlNzql-U6ziyy4gSnqnaUtdl5XB7W5sgCyBy2Ks0/view
best of luck on your game!

    person
    one solution would be to use push() pop() and translate() instead of camera
    might be more difficult but itd work

      3 months later

      Chat