🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

[Tutorial] How to create an option to scale your game in gamemaker!

A topic by Sniperninja564 created 320 days ago Views: 253 Replies: 7
Viewing posts 1 to 2
(Edited 3 times)

160x144 is a really small resolution to work with! It is also a very small resolution to view on your PC! So what you can do is use a function called window_set_size to scale your view. So this simple tutorial will teach you how to create a option to scale the size of your game while playing!


The only prerequisite is that you need a Main Menu Room!

First, we need to create the "scale" variable. Go to the main menu room, then go the creation code and type:


/// Initialize

global.scale = 1;


Next we need a button! Create a sprite (name it whatever you want) and make your button. What you need next is to create the button object! Create an object and set the sprite to the button you made!

Now we create the scale option. Place the object in your Main Menu Room and open up the object! Create a "Left Pressed" event and inside write this:


/// Change the size of the game!

global.scale += 1;

if (global.scale) > 5 {

global.scale = 1;

}

window_set_size(160*global.scale, 144*global.scale);


Let me explain how this works. Every time you click on the button the global variable "scale" is raised by one.

The if statement means if the global variable "scale" is more then 5 then it will set back to 0. The reason why we do this is so that way the scaled window isn't to big!

Finally window_set_size as it sounds, changes the window size to the size of the window TIMES the variable scale! So if "scale" is set to 2, then the scaled window is 2 times larger, and if it 5 then the window is 5 times larger.


Thanks for reading!

PS: Do NOT use port on screen. When you make a port, it adds in-between subpixels which ruins the gameboy's resolution. If you don't want to add the option just add this in your creation code:


window_set_size(160*4, 144*4);


This just makes your game show up 4 times bigger permanantly!

Awesome! I'll be implementing this tonight. Thanks!

I'm glad this help you :D

Works great! But the blurring was actually making things look better! Grr...

It was blurring!? Go to global game setting and make sure Interpolate Between Colours is turned off!

Err, not blurring, but the between pixels were smoothing out the motion. Now that it's pixel perfect, you can see the movement in little jerks sometimes.

Yeah, I have that problem too since my player moves at 1.5 pixels per frame!

(Edited 1 time)

In your draw events of your object that are moving at fractions of pixels have you tried wrapping the x and y in floor? So for example draw_sprite(sprite_index,image_index,floor(x), floor(y))


Sorry if you have. I just thought it might help with any juddering and such. :P