image to big

T

Theghost

Guest
Hello
I'm working on a game. My player sprite is 1000x1000. but I want to show it on the screen without it filling the entire screen.
How do I do that?
Thank you.
 

DarthTenebris

Definitely not a Sith Lord
Code:
var xscale = 1; // how much to scale in x axis
var yscale = 1; // how much to scale in y axis
draw_sprite_ext(sprite_index, image_index, x, y, xscale, yscale, image_angle, c_white, 1);
GMS2 manual: draw_sprite_ext()

There's another way which is shorter to type however results in changing your bounding box, which affects collision. If you want your object to look smaller but collide as if it were bigger, then use the above code, otherwise if you want it to collide according to the size it appears to be, then simply modify the scale directly:
Code:
image_xscale = 1;
image_yscale = 1;
Hope I helped :)
 

Relic

Member
A few options:

1) pre scale you art assets down before putting them in your game (using photoshop or whatever you made art with). This is useful if you never will be showing your character at its full size in game- it’s a waste of memory and adds to an issue called texture swapping.

2) set up a camera that shows a lot more of your room that just the default zoom level would do. The most common monitor size is 1080 pixels high- but you can have a camera that shows 10,000 pixels high and the view will be scaled down to fit onto the screen.

3) use image_xscale and image_yscale to affect how big your sprite is during runtime.
 

Toque

Member
I would change the sprite to the size it needs to be and then import it into GM.

Large sprites take up more ram.
 
Top