-
Notifications
You must be signed in to change notification settings - Fork 5
Basic Setup
-
Go to the Latest Release of STANNcam.
-
Download the
YYMPS
file in the Assets section. -
Import the
YYMPS
file into your GameMaker project:- In the top menu, go to: Tools > Import Local Package
- The Import Resources window will pop up, add everything from the STANNcam folder
Note
The STANNcam YYMPS
file also contains a few detailed examples on how to set up using STANNcam.
If you want to test STANNcam yourself before using it in your project, select Import all resources to a new project when importing STANNcam. This will import the STANNcam examples to a new project, leaving your current project unaffected.
When using STANNcam it's recommended to use a persistent controller object to manage your main camera, and drawing it to the display.
If you already have a persistent game manager object, you can use that as well.
// If you have resolution settings saved as an external file,
// you can load them and use it here when initializing STANNcam
stanncam_init(320, 240, 1920, 1080);
global.main_camera = new stanncam(obj_player.x, obj_player.y, global.game_w, global.game_h);
global.main_camera.follow = obj_player; // This will follow the player object
STANNcam disables the application_surface
once it's initiated.
The application_surface
is turned off so if you want your camera to show up, you need to use one of its .draw*()
methods in the Post-Draw Event.
// Here you also have the option to apply shaders before the camera's content is drawn.
// Or if you have a special parallax background object in your room you could draw it first.
global.main_camera.draw(0, 0);
If you want GUI elements drawn relative to the sides of the screen, in the corners of the screen, you can use global.gui_w
and global.gui_h
to get the coordinates right.
// Draws text in the bottom-right corner of the screen
var _padding = 10;
draw_set_halign(fa_right);
draw_set_valign(fa_bottom);
draw_text(global.gui_w - _padding, global.gui_h - _padding, "I'm text in the bottom-right corner");
For more in-depth examples, check the example GameMaker project in the repositiory.