[Solved] Problems with changing view positions/dimensions



Hey, I am making a game with a large map in which I want to move the camera with the arrow keys and zoom in and out with the mouse wheel. I have searched online on how to achieve this and usually, the answer would include the variables view_xview[...], view_wview[...] etc. Even the manual makes it seem like I can just change these variables to move around the view as well as change the height and width, but unfortunately, this does not work at all for me. Just for testing, I have made a very minimal project where I try to get the view to scroll across the level using
view_xview[0] +=5
in the step event of a special camera-managing object. The room has viewports enabled and the first viewport is set to visible. Yet when I launch the game, the view stands still.

Am I'm missing something about these variables? Because I don't think I've done anything different than the guides I've read.

I have since found a different way of moving the view, that being camera_set_view_pos, and it actually seems to work, but I find it quite annoying to deal with and would much rather just use view_xview etc. to manage my camera. If anyone could tell me what I'm doing wrong, I'd very much appreciate it. If not, I guess I'll have to learn using the more complex method.


Which GM are you using GM 1.4 is different than GMS2, they changed how views works and they dont even share the same commands between the two versions.
view_xview[] is a 1.4 thing and camera_set_view_pos() is a GMS2 thing.
The reason it might feel more complex is because in GMS2 they added viewport and the ability to have multiple cameras. Think picture in picture, or split screen games.

If you are using GMS2 Youtube has some videos to help you get your mind around it.



@kevins_office There has always been viewports as well as support for multiple projections (views, cameras, whatever you wish to call them).

But yes, they are very different in GMS2. In GMS1.4 they were built in to the room as properties and so there were pre-defined variables to modify them (such as view_xview). In GMS2 they are a structure that you must create and modify via functions.


Ah, that makes a lot of sense, yeah I am using GMS2. Thanks a lot for the explanation and the tutorial videos, I'll be sure to give them a go. I also noticed that the old manual url starts with "docs." while the new one uses "docs2.", which I probably should have realised before, but oh well :D