GameMaker [SOLVED] 2 Sprites not drawing properly

Gigicom

Member
Hello,

I am currently working on an inventory and am trying to position the slots properly over the inventory sprite.
I already did this once before, just with a smaller resolution and with a little different system.
For some reason though, the slots (blue) now are always a little bit ("half a pixel") misaligned with the inventory slots, even though they're the same size (64x64).
The camera and the inventory sprite (with the black transparent border) are both 1536x864.

The slots and the inventory objects are positioned with this code:
Slot Step Event:
Code:
x = camera_get_view_x(view_camera[0]) + 118;
y = camera_get_view_y(view_camera[0]) + 122;
Inventory Step Event:
Code:
x = camera_get_view_x(view_camera[0]);
y = camera_get_view_y(view_camera[0]);
upload_2019-8-1_15-22-40.png
 

Gigicom

Member
Is the inventory or anything being scaled? I see that the guy is scaled.
Yes, the inventory sprite is already scaled x4 (not in code, but Sprite Editor). The slot sprite is also scaled x4 (also not in the code, but Sprite Editor)
 

Kyrieru

Member
If they're scaled then moving by 1px is one px. To move by 1 "scaled" pixel it would need to move by 4.
118/4 = 29.5

Also, you shouldn't be scaling with the sprite editor.
draw the sprite in the draw event and use an image_xscale of 4.
 

Gigicom

Member
If they're scaled then moving by 1px is one px. To move by 1 "scaled" pixel it would need to move by 4.
118/4 = 29.5

Also, you shouldn't be scaling with the sprite editor.
draw the sprite in the draw event and use an image_xscale of 4.
I scaled both sprites with image_xscale = 4 and drew them in the draw event and now the slots are positioned properly.
Thank you very much.
 
Top