• 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!

[SOLVED] Room view leaves room boundaries.

P

pandaontoast

Guest
Hello, I have been following HeartBeast's tutorial for creating zooming and moving views with GML and have only one problem. Is there a way that I can disallow the view to leave the boundaries of the room?

ROOM SETTINGS (Yellow squares to show boundary)
upload_2017-2-28_16-20-55.png

ROOM VIEW
upload_2017-2-28_16-22-14.png

ZOOM SCRIPT
upload_2017-2-28_16-22-39.png

ZOOM OBJECT
upload_2017-2-28_16-23-8.png

Any help will be greatly appreciated.
Thanks!
 

Attachments

view_xview=clamp(view_xview,0,room_width-view_wview);
view_yview=clamp(view_yview,0,room_height-view_hview);

Put that after you've done everything else with moving your view.
 
Top