• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM [SOLVED] Sprites are sometimes offset by one pixel?

F

Ferrettomato

Guest
My game has its application surface resized to match the view (the view is 192x192, and the application surface is also 192x192). Sprites appear properly for the most part without needing any custom drawing, but occasionally objects that the view isn't centered on are sort of shifted by one pixel on the sprite sheet, as shown below:

With the glitch:

~~~

Without the glitch, like it sometimes is:


How can I fix this? Is there any code I need to share for more info?
 

RangerX

Member
What's the monitor resolution from which you took those screenshots?
What do you have in the graphic tab under your target's global settings? (keep aspect ratio checked?)
 
F

Ferrettomato

Guest
1920x1080, but it looks exactly the same in any resized window. Keep aspect ratio is checked.
 

RangerX

Member
Keep aspect ratio will automatically resize the application surface as big as possible in the screen while respecting screen ratio. Your game is square (192x192) and you ask GameMaker to display it in 1920x1080 pixels.
1080 / 192 = 5,625

GameMaker needs to resize your game by 5,625 times. Which is impossible because how can you have pixel fractions. A pixel is dot. Its lit or its not.
If you don't understand what I mean, maybe you want to read the beginning of my tutorial here. I explain precisely why graphical deformation like this occurs:
https://forum.yoyogames.com/index.php?threads/how-to-properly-scale-your-game.995/
 
F

Ferrettomato

Guest
It still has the problem when it hasn't been scaled up at all. (The default window size is 192x192.) I don't think the problem is anything to do with scaling the view, especially since it's only glitching an object (and only objects, never tiles), not the whole screen.

(also, I'd already read your tutorial while trying to fix this.)
 

RangerX

Member
In your screenshot I see deformation everywhere, you notice it on some objects but its everywhere. Look at your stars... they are not all square.

Now try something:
- Make sure you have "keep aspect ratio" checked in the graphic tab.
- Make sure the view size, port size and application size are 216x216.
(don't resize it, make your view and port that size for the test)

If you do that and your monitor really is in 1920x1080, you will have no pixel deformation.
 
F

Ferrettomato

Guest
* "Keep aspect ratio" is checked. (it always was, like I said)
* The view size, port size, and application surface are all 216x216.
* It's being displayed on a 1920x1080 monitor. (I tried it in both maximized window mode and fullscreen mode.)
* It's still glitching objects when the view isn't centered on them, just like before.

I really do think there's a different problem, because it looks the same no matter what scale it's at.

EDIT: Looking closer, that did make the pixels squarer, but the sprite sheet shifting thing is still happening. The pixel deformation was a different problem, and not what I was asking about.

EDIT 2: Here's the glitch now:
 
Last edited:
F

Ferrettomato

Guest
Ohhhhhh

I'd tried rounding its draw position, but that looked bad, and I assumed that rounding its actual position would cause problems too for some reason, so, against all reason, I never tried it. Everything looks fantastic now! (although I'll have to work on the game's resizability...) Thanks a bunch!
 
Top