Game not Scaling properly

I’m currently working on a game in defold however when I build it and messed with the window sizes the objects stretched or squished.

Normal:


Window size changed:

If anyone could help me that would be great!

The default render setup does not maintain aspect ratio.
Here you can find a bit more information that should get you up and running quickly:

3 Likes

In my game I have it so that the blue circle moves toward the mouse however when I scale it using msg.post("@render:", "use_fixed_fit_projection") it does this (Red dot represents mouse)

This is my blue circle code

function init(self)
    msg.post(".", "acquire_input_focus")
end


-- Go to mouse 
function on_input(self, action_id, action)
    if action.x and action.y then
        go.set_position(vmath.vector3(action.x, action.y, 1))
    end
end

Because the viewport is now scaled, you need to convert the mouse coordinates to the new projection.
This can get a bit more complicated, having to deal with the render script and such.
I highly recommend using an extension like orthographic, that does all the heavy lifting for you and is easy to setup, while you get familiar with all the nuances of Defold.