Description

This is a very simple script that can be used to scale your games view port and camera view to fit the window size, or display size if your game is running full screen. Copy and paste from here or use the screenshot for the code:

var scale = argument0

var w = window_get_width() / scale; var h = window_get_height() / scale;

display_set_gui_size(w, h);

var cam = view_get_camera(0);

view_set_wport(0, w); view_set_hport(0, h);

camera_set_view_size(cam, view_wport[0], view_hport[0]);

// leave this part out if you don't use views to follow an object. camera_set_view_target(view_camera[0], player_obj); camera_set_view_border(view_camera[0], w/2, h/2);

surface_resize(application_surface, w, h);

Add this script to the room creation code or an objects creation code, as long as that object is created right at the beginning of the game. Your game will now scale correctly.

if you need dynamic resizing as shown in the video, put this code into an objects step event, and either make that object persistent or place that object in every room. You will also be able to swap from full screen to windowed mode with no problem either.

The only argument needed for the script is argument0, which sets the scale of the game view shown. A value of 1 as argment0 will display all sprites at 1:1 scale. A value of 1.5 will display 150% size, a value of 2 will display at 200% size and so on. It is best to stick with whole numbers, unless you are doubling or tripling your pixel art.

For example, a sprite of 1 x 1 pixel will be displayed correctly with scale values of 1, 2, 3 etc, but will be displayed distorted if 1.5, 2.3, 3.8 etc is used, as the single pixel will not be able scale in that way. Experiment with this value though, find the best number that works for what you're doing.

End User Licence Agreement (EULA).

Version 0.0.1. Published March 7, 2018

Age Rating: 4+

Average Rating

Your review

You can only review assets you've bought.


Gravatar

Anonymous 29 March 2019


Gravatar

Antoin R 06 March 2019

Wonderful scrip. Very beginner friendly.


Gravatar

Panayiotis Y 22 November 2018


Gravatar

Emmanuel R 12 May 2018

Excellent

Works perfect. It's everything I always looked for

Package contents

Loading, please wait

What is the issue?

Back to Top