Pixel perfect movement?

I’m making a 2D pixel art game and I want to avoid having any sprites get ‘stretched’ or ‘squashed’, where some pixels look strange and the overall art is ruined.

As part of this, I want to enable some sort of ‘pixel snap’ camera, so that when I move a sprite, it snaps into a pixel perfect position when stopped - rather than stopping wherever it naturally would, which might be in the middle of a background pixel.

How would I go about setting this up?

Thanks :slight_smile:

EDIT: window resolution is set at 320x180 (so it can scale nicely to 720 and 1080), resizing is disabled and scaling mode is set to ‘nearest’. Problem is occurring anyway.

1 Like

In your game’s properties
Use a small window resolution.
Then when your game starts (at the beginning of the first scene) change the size of the game’s window with an event so it won’t be tiny.

Disable the resize and choose the “nearest” scaling mode:
And #2:
Use the grid to snap objects:

Hi, my bad - I should’ve sad in my original post that I’m already using a small resolution. When testing, I scale this up to full screen and it has these issues.

Hi, sorry, I should’ve clarified that in my original post. Resizing is already turned off and scaling mode is set to ‘nearest’.

Problem occurs anyway.

Something’s weird with either:

  • Your movement events
  • Your art
  • Your base resolution.

If your base resolution doesn’t scale appropriately into a larger 16x9 (or 4:3) resolution, your art will always be stretched/squished.

In general, that would mean your “small” size game resolution should be either 320x160 or 640x320 for 16:9, or 320x240/640x480 for 4:3.
If you’re using some other version at a small resolution you’ll run into issues.

I’ve tested 16x16 base art scaled up from 320x160 and don’t have any squishing or blurrying while moving.

1 Like

When you say 320x180, don’t you mean 320x180? Because 160 doesn’t scale neatly into 1080?

My movement is just the standard GDevelop platform character movement.

My sprites are done on a 32x32 canvas and then cropped. My backgrounds are a full 320x180.

My base resolution is set to 320x180, with nearest scaling turned on and stretching to fill a screen turned off.

I’m so confused about what I can do to remedy this - do you spot any issues?

Try to do it like this

Also, don’t forget to make your resources NOT smooth
2020-07-26%2C11-19-42-Selection 2020-07-26%2C11-20-00-Selection

Can you show a screenshot of the difference between the editor and the preview? :slight_smile:

Yep, sorry, 320x180/640x360. That’s what I get for posting at near midnight. Gruk’s correct though, we’d need to see what you’re seeing to understand.

I am new to Gdevelop5 . So how can i make (the pixels of an image is in collision with a box are invisible while the other pixels of the image are visible ) .

I know about Z order and with i can make the image under the box ,but I wanna know if i can do the pixels thing in Gdevelop5.

Please do not bump posts with unrelated questions. Please feel free to make a new thread with your unrelated item.