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

Circular viewport (or camera) in GMS 2

C

Cjohs

Guest
Hi
I would like to make a circular secondary viewport for a minimap. How to go about that?
It is easy enough for me to create a rectangular one (with zooming and scrolling and all that) using the built in viewports, but a circular one...?? I dont know where to begin: can it be done using the built in stuff (viewports and cameras) or will I have to do the hard lifting myself?
 
I

icuurd12b42

Guest
draw your minimap to a surface instead of having another view
then draw a sprite on the surface with bm_subtract. The sprite being the shape you want where white and alpha 1 parts will turn transparent... and black, alpha 0 will remain intact
then draw the surface where your minimap would go
 
I'm trying to do something similar so that I can show the player an area off the map like a how you would imagine a surveillance camera. I've got it working using the view_set_surface_id function to but the shape is a square and if I try to set the surface to a circle using bm_subtract then I just get a circle but the viewport doesn't show up on the surface anymore.
 
Top