Hello! Xtend allows you to move the scaled view, but if you're relying on an older method (e.g. backwards compatibility scripts from GMS 1.x) you will need to update to GMS 2 standards. Specifically, you should be using the camera_set_view_* functions, such as camera_set_view_pos, to move the view camera with your player.
I am using camera_set_view_pos(cam, x-temp_cam_w_half, y-temp_cam_h_half); in step. But after I change the screen resolution, my camera is attached to the upper left corner. https://i.imgur.com/L6sOhbJ.png
It looks like you're doing a lot of manual calculations to solve things Xtend provides for you. While not all of the code is visible in your screenshot, it's possible some of your existing camera system is conflicting with Xtend. I would recommend going through the Macros & Keywords documentation and updating your code to use Xtend's provided values. You should be able to remove a lot of custom code from your project this way.
I have tried commenting all my code, and leaving only your plugin. Result 1. After changing the resolution, I can't get the camera to follow the character. yes, there is a lot of superfluous in the code, but there is nothing in it that would break the camera. macro values from the plugin are identical to those that I have.
A few notes here:
- I still see window functions from another extension in your example. Some of these functions appear redundant to Xtend and may be interfering.
- Your code is using instance variables for things like cam, which is not a good idea. The actual camera ID assigned to a view can change, at which point your variable would become obsolete. It is best to always reference view_camera[0] directly or use a macro instead of a variable for shorthand.
Some debug ideas:
- Draw the value of view_camera[0] and check for changes. (If the camera ID changes and your cam variable isn't updated, the camera will stop following the player.)
- Draw the value of window_resized() and make sure it only returns true for one frame. If it gets stuck on true, something in your code is causing Xtend to always register a change in scale even when there is none. (If this happens, the camera will always attempt to correct its position for changes in scale and will never have a chance to follow the player.)