# Toggle movability of different sprites

**URL:** <https://forum.makecode.com/t/toggle-movability-of-different-sprites/6171>\
**Category:** Help\
**Created:** [February 13, 2021, 5:03pm UTC](https://forum.makecode.com/t/toggle-movability-of-different-sprites/6171 "2021-02-13T17:03:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peb7](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peb7](https://forum.makecode.com/u/peb7)\
**Post date:** [February 13, 2021, 5:03pm UTC](https://forum.makecode.com/t/toggle-movability-of-different-sprites/6171/1 "2021-02-13T17:03:42Z")

</div>

Hi All,

I am trying to toggle between different spritess by pressing the ‘A’ button but i’m stuck for an hour. Here is what I have so far:

> **[toggleSpriteDemo](https://arcade.makecode.com/23921-78503-56742-28534)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Any advice? Thanks.  
-Peb

---

<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 13, 2021, 7:08pm UTC](https://forum.makecode.com/t/toggle-movability-of-different-sprites/6171/2 "2021-02-13T19:08:36Z")

</div>

You’re allowed to make multiple sprites move with buttons at once, so when you want one to stop, you have to clear it - this can be done by setting the speed to 0:

 ![SmartSelect_20210213-110522_Chrome](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/48b36c1dfbc64a8dd18be5c9f9944effbb4e7b67.jpeg)

I moved some of the code out of the on game update to make your example work like I think you would expect:

> **[toggleSpriteDemo](https://arcade.makecode.com/81477-42907-71468-51283)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![peb7](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peb7](https://forum.makecode.com/u/peb7)\
**Post date:** [February 13, 2021, 9:59pm UTC](https://forum.makecode.com/t/toggle-movability-of-different-sprites/6171/3 "2021-02-13T21:59:00Z")

</div>

Thank you, jwunderl. It works as expected now!
