# Code to add a little bit of slide physics

**URL:** <https://forum.makecode.com/t/code-to-add-a-little-bit-of-slide-physics/11822>\
**Category:** Arcade\
**Tags:** game\
**Created:** [January 21, 2022, 5:21pm UTC](https://forum.makecode.com/t/code-to-add-a-little-bit-of-slide-physics/11822 "2022-01-21T17:21:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)\
**Post date:** [January 21, 2022, 5:21pm UTC](https://forum.makecode.com/t/code-to-add-a-little-bit-of-slide-physics/11822/1 "2022-01-21T17:21:27Z")

</div>

This works for ice levels or for like sliding a bit after the character stops moving  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/04ee81741b102b6c34a348f0b5e57d23ff1fc272.png)

---

<div class="post-metadata">

**Author:** ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)\
**Post date:** [February 2, 2022, 5:44pm UTC](https://forum.makecode.com/t/code-to-add-a-little-bit-of-slide-physics/11822/2 "2022-02-02T17:44:43Z")

</div>

I turned it into a function 😃  
The perameter determines how much the character slides

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/ed1feec2db29f10505e11034f1d487562d3da33c.png)

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [February 2, 2022, 10:45pm UTC](https://forum.makecode.com/t/code-to-add-a-little-bit-of-slide-physics/11822/3 "2022-02-02T22:45:54Z")

</div>

Nice job implementing this, it can be challenging to get exactly right! In case it helps in your other games, we actually have a feature that can support situations like this; a sprite’s fx and fy (friction x / y) basically act as acceleration towards 0 (note that currently they are only used if the corresponding ax / ay are 0).

Here’s a quick example:

> **[Using fx/fy](https://arcade.makecode.com/53580-42662-95730-78858)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)\
**Post date:** [February 3, 2022, 2:09am UTC](https://forum.makecode.com/t/code-to-add-a-little-bit-of-slide-physics/11822/4 "2022-02-03T02:09:29Z")

</div>

OK thanks!
