Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Here is how my camera works:

obj_camera

Create event:

//Scale multiplier
scale_mult = 5;

//View resolution
view_wview = 160;
view_hview = 144;

//Set view to the resolution multiplied by the scale multiplier
window_set_size(160*scale_mult, 144*scale_mult);

//Reset surface to apply modifications
surface_resize(application_surface,view_wview,view_hview);


Not required, but handy to modify the zoom while the game runs:

Step event:

//Inputs to modify zoom on the fly
key_zoom_plus = keyboard_check_pressed(vk_f9);
key_zoom_minus = keyboard_check_pressed(vk_f10);


if (key_zoom_plus)
{

///Camera code


scale_mult += 1;
scale_mult = clamp (scale_mult, 1, 6);

view_wview = 160;
view_hview = 144;

window_set_size(160*scale_mult, 144*scale_mult);

//Reset surface to apply modifications
surface_resize(application_surface,view_wview,view_hview);
}


if (key_zoom_minus)
{
///Camera code

scale_mult -= 1;
scale_mult = clamp (scale_mult, 1, 6);

view_wview = 160;
view_hview = 144;

window_set_size(160*scale_mult, 144*scale_mult);

//Reset surface to apply modifications
surface_resize(application_surface,view_wview,view_hview);
}


Hope it can help!