[SOLVED] Fixing PixelPerfect Movement extension

Hello everyone!

So I’ve been wanting to make a top down RPG where the character move from “tile to tile”. I found this neat little extension called “Pixel Perfect Movement” which does exactly that. Here is the problem though:

On a tile grid of 16x16, with a character of the same size, whenever the character moves, ever so slightly chaotically, the sprite will constantly get offset of one pixels if not a few. It seems completely random. I’ve tried changing the max speed, the acceleration, the deceleration, it simply do not work.

I simply want it to stop offsetting my character randomly, no matter how chaotic my movements are.

https://imgur.com/a/t4oPB0g
First screen: This is the normal state of the character when booting up.
Second screen: Character got slightly offset by 1px to the left, and 1px down.

Here is the full project (Side notes: try avoiding colliding with the red guy as it closes the game, and if you collide with that ugly door, simply press Escape key to close the game).

Thank you in advance!

Do you use snap to grid extension?
Which is also called rectangular grid?
If not then you should

BTW

Hey, I don’t have much to say, I just wanted to welcome you to the forum! :hugs:

Thank you, but that just creates more problems than it solve. Literally sticks you to a grid without ever being able to move. Only way that I can see that work would be to offset the character, which would make it so that you need to offset the background, all the other objects, and I’m not even sure if tilemaps would work.

Also I know about that template. My project is the same, literally. Yet, I have this problem while that templates do not, which is why I posted here, to figure it out.

Also thank you @Shark_Chum =)

1 Like

Then you did something else than template did

i would start by checking my objects animation are all same size

Not really, no. I literally redone the entire template 1:1 and this problem still persist, even on a new project. Everything is the same size, grid is at the correct size too.

It is impossible for it to work different way if EVERYTHING is exactly the same

How about you download this example and try it on your gdevelop?

IF it work perfectly fine then switch its sprites with your sprites

Really no way it works different if everything is the same

Did just that. Simply took the template, replaced the sprite with the same ones that was on that project link i posted, problem still occured.

I then reloaded the template again, simply modified how the sprites looked directly in the piskel editor, and that problem still occured. It’s quite simple to reproduce actually: simply replace the player with a red block, the background with some random colour and a clear outline, move around a tiny bit chaotically and you’ll get offset a few pixels. It’s alot more visible that way.

For 3 mins i was spamming arrow keys even was trying to press multiple ones opposite directions at the same time
I can’t reproduce
In example it snaps to grid perfectly

Guess that’s just a me thing then.

Maybe it is just me

Make new post asking ppl to test this example trying to get off the grid with spamming arrow keys

Maybe someone will succeed i couldn’t

But if it happens to you it can happen to others
IDK why i can’t reproduce

Like i said in example i linked in my 1st post here i can’t reproduce this bug

Yet in your project i have no problem reproducing it with just like 3 moves

OK what i did
I opened that example i linked
I hit hit File > Save as > to my pc

I opened it in my gdevelop on desktop and i did same thing
File > save as > my pc (this time to same folder as game is)
So it download all assets and nothing is taken from cloud

Now i simply replaced image of brad4 with image of your player

I even copied your events into this copy of project and it is working perfectly fine

I do give you that
I did find few difference (in top down movement values) which were not same in example as in your project
But even after changing i could not find anything that would fix that getting out of grid

I also noticed that moving left and right player in your project is like shaking? a little bit idk how to describe it
While in example it is smooth as butter i try to make gif

Your project
2023-09-07_07_13_OWycLWL4Cb_GDevelop

Your player in example project
2023-09-07_07_14_0CPzwdxmiV_GDevelop

All your events are there

You just need to connect them to your dialogue or more likely create your dialogue

IDK WTF is going on
My best guess example using some older version of some extension? IDK But as you see it works perfectly build upon that

This bug is absolutely confusing the hell out of me, I won’t lie. This morning I tried (again) to see if I could get it to work on my side. Simply took the template, replaced the bard4 with my sprites, and well…: https://imgur.com/a/pgXcXiB the offset happened.

But then I downloaded yours and it’s all fine. I guess the mystery will stay, thank you though. Unsure if we can call that solved.

Update your post title

And do not question good fortune
Just accept it
That is kinda 1st rule of development

IF it works do not investigate why
Just let it be