# Stopping a Sprite

**URL:** <https://forum.makecode.com/t/stopping-a-sprite/3363>\
**Category:** Help\
**Created:** [September 4, 2020, 10:08pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363 "2020-09-04T22:08:42Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 5, 2020, 2:08am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/21 "2020-09-05T02:08:24Z")

</div>

The problem with this is that you can’t move the sprites after they touch. I want the sprites to be like tilemap walls.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 5, 2020, 2:14am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/22 "2020-09-05T02:14:03Z")

</div>

What you could do is if a sprite is touching the “wall” sprite, than move it away until it’s not touching in `on game update`

But then you wouldn’t know the direction in which it came from

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 5, 2020, 3:38am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/23 "2020-09-05T03:38:25Z")

</div>

Maybe. I know how to find the direction. I wish there was a better way to do what I want to do. 😫

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 5, 2020, 5:27am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/24 "2020-09-05T05:27:11Z")

</div>

What is your intention? To move the sprite?

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 5, 2020, 10:44am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/25 "2020-09-05T10:44:17Z")

</div>

You could also set a wall where your sprite is, and if it moves, just set the location under to a wall

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 5, 2020, 10:44am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/26 "2020-09-05T10:44:30Z")

</div>

But then it would have to be ghost

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 5, 2020, 2:45pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/27 "2020-09-05T14:45:18Z")

</div>

I was thinking about that, but it would cause a lot of lag. This is because I am using multiple sprites as walls. I will try it.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [September 5, 2020, 3:40pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/28 "2020-09-05T15:40:53Z")

</div>

So you are using sprites as a wall

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [September 5, 2020, 3:41pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/29 "2020-09-05T15:41:14Z")

</div>

I have an idea but i don’t know if it will work

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 5, 2020, 4:13pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/30 "2020-09-05T16:13:08Z")

</div>

What is the idea? I want to come up with the most efficient way to make walls on the sprite. The sprites in my real game are 16 by 32 and 16 by 48.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [September 5, 2020, 4:56pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/31 "2020-09-05T16:56:44Z")

</div>

If your sprites bottom is greater than the wall sprites top, move it up.  
If the sprites left is less than the wall sprites right, move it right. Etc.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 5, 2020, 5:02pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/32 "2020-09-05T17:02:18Z")

</div>

The problem with that is that if the sprite is in front of the wall, it will also move back.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 10, 2020, 1:05am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/33 "2020-09-10T01:05:00Z")

</div>

Can anyone please help? (thanks for efforts: @UnsignedArduino, @LcAtonal and @Dreadmask197)

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 10, 2020, 4:33am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/34 "2020-09-10T04:33:49Z")

</div>

You want to push the sprite?  
Try this:

> **[PushingSprite](https://arcade.makecode.com/55730-16071-28489-37640)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![LcAtonal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/lcatonal/32/16800_2.png) [@LcAtonal](https://forum.makecode.com/u/LcAtonal)\
**Post date:** [September 10, 2020, 8:40am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/35 "2020-09-10T08:40:06Z")

</div>

Press menu to restart

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [September 10, 2020, 9:28pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/36 "2020-09-10T21:28:46Z")

</div>

Not quite what I am looking for.

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [October 6, 2020, 11:19pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/37 "2020-10-06T23:19:13Z")

</div>

> **[example sprites stop when overlapping](https://arcade.makecode.com/01426-50884-55679-40424)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

  
I included the two statements at the bottom the overlap function.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/a/a0581e023403945ff913c48a91246f809d567d2a.png)

I this what you are looking for?

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 6, 2020, 11:35pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/38 "2020-10-06T23:35:08Z")

</div>

He wants them to move again and wants to use the other sprite almost like a wall

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [October 6, 2020, 11:50pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/39 "2020-10-06T23:50:23Z")

</div>

That is a really cool implementation of pushing a sprite; great job.

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [October 6, 2020, 11:52pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/40 "2020-10-06T23:52:14Z")

</div>

Well I guess if @GameGod is able to better explain what the game should do, then we might be able to help.

[Previous page](https://forum.makecode.com/t/stopping-a-sprite/3363.md?page=1)

[Next page](https://forum.makecode.com/t/stopping-a-sprite/3363.md?page=3)
