Jittery movements

Hey, I’m working on a game and trying to implement hitboxes. However, the movement looks really jittery when I move. I’m using separate sprites for the character and the hitbox. I’m not sure what’s causing this, since I don’t think it has to do with the hitbox itself. Even when I remove the character sprite completely, it still looks bad. Does anyone know what might be causing this?

Here’s the link:

btw i have no idea what happened to the preview GIF lol.

5 Likes

looks abolutely sick
To fix the jitter


use forever block instead, it seems to fix the jitter (i think because game update is slower?)

I’ve seen this before… It’s weird. In my experience, it happens in some of the projects I make. I make a new one and it’s fixed. I dunno, there’s probably a way around it.

If I remember correctly, there is a weird camera bug that does this with sprites of specific sizes. If you try changing the size of the sprite, does it help? (You might have to make the sprite bigger or smaller to change the hitbox)

i think its because your player’s width is an odd number

2 Likes

Just to answer everybody. The sprite size was indeed the problem. I didn`t actually know that an odd number of pixels would make this happen. And to answer Luke. No it isn’t really better to ise a forever loop in this scenario. It is actually slower. If you turn off the invisibility on the hitbox and change to a forever loop, you can see that the character is lagging behind. Thanks for the help guys!

2 Likes

i think the reason why an odd number makes it jittery is because makecode uses a centered coordinate system instead of a top-left coordinate system so when a sprite image has an odd number width or height it has to round its position to the nearest number and sometimes it does that 1 pixel more, and sometimes it does that 1 pixel less, thus causing that jittery problem.

3 Likes