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.)