# Sprites other than 16x16 move unsmoothly?

**URL:** <https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181>\
**Category:** Help\
**Tags:** graphics-and-math\
**Created:** [October 9, 2023, 9:16pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181 "2023-10-09T21:16:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [October 9, 2023, 9:16pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/1 "2023-10-09T21:16:40Z")

</div>

To get some better practice with MakeCode Arcade sprite movements and animations, I have recently been playing around with the [following help request from](https://forum.makecode.com/t/animation-not-working-in-this-code/15506) @jaturn68.

What I might have discovered(at least on my computers and browsers), and which baffled me, is that using the regular _controller.moveSprite(vx, vy)_ function on a 16x16 sprite gives silky smooth movement on the x axis with any sprite image and at arbitrary vx speeds, while movement gets choppy for irregularly or different sized sprites, like 15x17 and 17x17.

To test and compare movement for differently sized sprites at various speeds, I made a small program with a 15x17 sprite for player1 and a 16x16 sprite for player2, where one can also change vx speed for both by pressing the A button:

> **[choppy\_sprite\_movements](https://arcade.makecode.com/32997-88940-43158-02338)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Note:  
-The uneven 15x17 sprite of player1 coincidentally(?) moves pretty smoothly at vx speeds 50, 100 and 150, but not at other speeds…  
-[This Sonic game](https://forum.makecode.com/t/sonic-micro-adventure/9934), however, does not exhibit as clearly choppy movements if one changes its 21x27 sprite to other vx speeds than multiples of 50.

_What am I doing wrong here or I do not understand? Is there a way to overcome choppy movements for sprites of other sizes than 16x16 and at any speed?_

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [October 10, 2023, 4:33pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/2 "2023-10-10T16:33:24Z")

</div>

Filed:

> <https://github.com/microsoft/pxt-arcade/issues/6115>
>
> \*\*Describe the bug\*\*
> Sprites of other sizes than 16x16 pixels moves unevenly/st…uttering horizontally, especially at vx speeds which are not a multiple of 50.
> 
> As mentioned on the forum here:
> https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181
> 
> \*\*To Reproduce\*\*
> Direct link to a program for testing and comparing movement for differently sized sprites at various speeds, with a 15x17 sprite for player1 and a 16x16 sprite for player2, where one can also change vx speed for both by pressing the A button:
> https://arcade.makecode.com/32997-88940-43158-02338
> 
> \*\*Expected behavior\*\*
> All sized sprites to move equally smoothly across the screen at any speeds.
> 
> \*\*Desktop (please complete the following information):\*\*
> - OS: any
> - Browser: any
> - Version: any
> 
> \*\*Smartphone (please complete the following information):\*\*
> - Device: any
> - OS: any
> - Browser any
> - Version any

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [October 10, 2023, 4:47pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/3 "2023-10-10T16:47:54Z")

</div>

make the sprite a paire size

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [October 10, 2023, 6:42pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/4 "2023-10-10T18:42:38Z")

</div>

Yep, very choppy, don’t know why

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [October 10, 2023, 7:16pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/5 "2023-10-10T19:16:23Z")

</div>

Thanks for the input, @YuHayate!

You are right, the deciding criteria for smooth horizontal movements appears - after having tried a couple of more alternatives based on your answer - to be even sprite sizes for width(x) X even/odd for height(y).

Here’s another example with 18x17 and 16x16 sprites, respectively, and both moving smoothly.

> **[choppy\_sprite\_movements](https://arcade.makecode.com/16408-15950-61662-49327)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I will update the GitHub issue accordingly.

_Is this a bug or a feature?_ And why is it like this?

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [October 10, 2023, 7:23pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/6 "2023-10-10T19:23:24Z")

</div>

Now I get why the floors on Floor 13 were moving unsmoothly 😑  
I’m pretty sure making something move too fast makes it choppy as well

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [March 13, 2024, 6:54pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/7 "2024-03-13T18:54:01Z")

</div>

When you first posted this, I was going to make an intricate thing to explain it, but I never ended up posting it.  
why? Well, I have a history of AI looking posts, so i don’t want to post anything anymore in fear of being called out for it again even tho i dont use AI much  
well anyways

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [March 13, 2024, 6:54pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/8 "2024-03-13T18:54:06Z")

</div>

it has choppy movement we just don’t see it because the sprite can stay in the middle of the screen if its diminutions allow it  
if you want some way of knowing with math you can use  
mod(screenWidth,SpriteWidth) == 0  
if it outputes true then ou will have smooth movement otherwise yea

other way:  
if the screen with is pair then the sprite width has to be pair too  
same thing for odd screen size

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [March 13, 2024, 11:02pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/9 "2024-03-13T23:02:49Z")

</div>

How I understand it is: because the sprite can never be in the exact center of the screen with an odd X, the camera doesn’t update its position when the sprites is right or left of the center, but only moves when the sprite gets 2 pixels away from centered. So the sprite goes from one side of the middle to the other repeatedly instead of the camera making the sprite centered every time. (Does this mean you could fix this by writing your own camera movement code instead of using the [camera follow] block?!? I have not tested it.)

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [March 15, 2024, 6:12pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/10 "2024-03-15T18:12:03Z")

</div>

I believe this has been fixed already:  
[https://github.com/microsoft/pxt-arcade/issues/6115](https://github.com/microsoft/pxt-arcade/issues/6115)

I also have some faint memories of testing it ok using my example in the original post, but forgot to update this thread.

---

<div class="post-metadata">

**Author:** ![Brainstorm\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brainstorm_studios/32/20476_2.png) [@Brainstorm\_Studios](https://forum.makecode.com/u/Brainstorm_Studios)\
**Post date:** [April 2, 2024, 5:11pm UTC](https://forum.makecode.com/t/sprites-other-than-16x16-move-unsmoothly/23181/11 "2024-04-02T17:11:36Z")

</div>

never fear, brainstorm is here. what you need to do is make an invisible body sprite that handles all the physics and has a different sprite kind than the main sprite, which handles all the animations. i would recommend making the body sprite kind “player” and adding a custom “display” kind for the main sprite, and setting the body sprite to invisible and the anim sprite to ghost.
