GML (SOLVED) While using draw_sprite_ext to upscale sprites, bounding boxes do not scale along.

Yavga

Member


Hello community,

I hope the picture speaks for itself:

to keep the texture pages small and optimal I decided to upscale every sprite by a factor of 3, so I can
make the game 1080p and work in high resolutions while keeping a pixelated look and feel.

My game takes place in a physics world but the bounding boxes the sprites have seem to stay at their original size, I noticed this because in my game you control a pair of arms and you pick up objects, somehow the bounding boxes seem off, This happens with every upscaled object so far. because the fixtures seem correct (debugger shows correct lines and player character DOES collide correctly) I think the problem lies with the sprites specifically and not with the fixtures.

My question is, is my presumption correct and am I doing something wrong with draw_sprite ext or would the problem be related to something else?

I couldn't find my answer on the Internet OR this forum so far.
If my question is not clear I will help to the best of my ability to assist.
 

Yavga

Member
I have found the solution on my own!
I hope anyone who has the same problem will find this solution helpful:

The problem occured in draw_sprite_ext like I presumed.

The problem was that the scale fell back to 1 instead of *3.
I checked this with:
Code:
show_debug_message("(X Scale: " + string(image_xscale) + ", Y Scale: " + string(image_yscale) + ")");
(Thanks to https://forum.yoyogames.com/index.php?threads/how-to-sync-collision-mask-with-the-image-scale.30388/)

In order to solve it I had to change the scale value in draw_sprite_ext from *3 to 1
and instead of changing the scale through the draw event I had to add it to the create event.

Code:
image_xscale *= 3
image_yscale *= 3
 
Top