GameMaker How to display objects in certain viewports/cameras?

Q

qbot21

Guest
Hello everyone :)

I'm fairly new to the GM2 camera system.

Im working on a small prototype of pc board game. The main idea for UI contains fullscreen, scrollable map (done) and player cards shown on top of the map and 'moving' with view when player navigates the map. Here's the problem. For now Im using camera_get_view_x/y to keep all elements in view, but that's not very flexible solution for me even with parenting.

Can I create one (red) camera that displays the map and let me navigate through it with mouse and then second (green), static one displaying only cards and popups regardless of first camera position in the room?

ui.png

Thanks !!!
 

samspade

Member
Hello everyone :)

I'm fairly new to the GM2 camera system.

Im working on a small prototype of pc board game. The main idea for UI contains fullscreen, scrollable map (done) and player cards shown on top of the map and 'moving' with view when player navigates the map. Here's the problem. For now Im using camera_get_view_x/y to keep all elements in view, but that's not very flexible solution for me even with parenting.

Can I create one (red) camera that displays the map and let me navigate through it with mouse and then second (green), static one displaying only cards and popups regardless of first camera position in the room?

View attachment 21815

Thanks !!!
First, as a former (and sometimes still) hobby board game designer, welcome. Someday maybe I'll take one of my games and make them digital. To answer your question, yes, although this might be easier to do with surfaces or even the GUI layer if what you want is simple enough.

If the things in green are stationary like a normal HUD in a video game displaying character stats, then you probably just want to draw them to the GUI layer. The GUI layer is always drawn last, so above everything in the room, and it's always 0, 0 through gui_width and gui_heigh, effectively meaning a second coordinate system that doesn't move.

The only reason you'd want to use views or surfaces for the things in green would be if you were also going to move those. For example, they were zoomed in views of the map showing each character. So the red view was the game map and the green views were different views into that map. Then you would want to use separate views or a surface perhaps. If that's what you want let us know and maybe provide more specifics as we can help.
 
Top