• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Automatically set camera and viewport properties through code?

Xalezar

Member
I have a game in which all the rooms will be the same size (playable levels, start screen, menus, etc.). Currently, I'm manually entering values in the map editor for the X Pos, Y Pos, Width, Height, etc. for each room. But I'm wondering if I can leave those input fields alone, and just set the same values for every room through GML using a "Room Start" event. I'd like to know, because I'm worried it will be very tedious later on if I decide to change the viewport size, and will have to manually enter the values into those fields for each room.
 

2Dcube

Member
Yes this is possible.
Look at the camera / view functions in the manual and use all that you think you need.
It might take some figuring out to get it right (especially if your game works on multiple platforms or platforms with multiple screen sizes)
but once you get it right you should be able to re-use it in future projects as well.

I haven't entered them manually for a few years now.
 

Xalezar

Member
Yes this is possible.
Look at the camera / view functions in the manual and use all that you think you need.
It might take some figuring out to get it right (especially if your game works on multiple platforms or platforms with multiple screen sizes)
but once you get it right you should be able to re-use it in future projects as well.

I haven't entered them manually for a few years now.
Cool, thanks! I'll give it a try and post my code if I get stuck (or find a solution that could be further optimized).
 
Top