# 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:** 1

<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 4, 2020, 10:08pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/1 "2020-09-04T22:08:42Z")

</div>

I know this sounds simple, but I’ve tried everything. How can I stop a sprite when it hits another sprite? I tried setting the velocity to zero, and I tried moving the sprite back a few pixels, but nothing works.

---

<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 4, 2020, 10:33pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/2 "2020-09-04T22:33:36Z")

</div>

Code?

Setting velocity (and acceleration if you used it) to 0 should do the trick

---

<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 4, 2020, 10:34pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/3 "2020-09-04T22:34:14Z")

</div>

okay thanks!

---

<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 4, 2020, 10:35pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/4 "2020-09-04T22:35:55Z")

</div>

It doesn’t seem to work.

---

<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 4, 2020, 10:37pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/5 "2020-09-04T22:37:20Z")

</div>

Can I see your code? Maybe you didn’t set a variable to your intended sprite and left it at `mySprite`

---

<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 4, 2020, 10:38pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/6 "2020-09-04T22:38:06Z")

</div>

Okay I will share an example.

---

<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 4, 2020, 10:42pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/7 "2020-09-04T22:42:11Z")

</div>

> **[example](https://arcade.makecode.com/34244-17764-88569-76849)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

  
here (just an example)

---

<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 4, 2020, 11:01pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/8 "2020-09-04T23:01:55Z")

</div>

Oh! I know what you mean!  
Try this `on overlap`:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/e599b0dbf54884e5dc5fcf2f3ccdacc8143af0db.png)

---

<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 4, 2020, 11:21pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/9 "2020-09-04T23:21:33Z")

</div>

Then how do I make them move after this?

---

<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 4, 2020, 11:49pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/10 "2020-09-04T23:49:04Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4cb56f763a2a3422addae32ab4d99af89b464f29.png)  
(In block of code obviously)

---

<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 4, 2020, 11:57pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/11 "2020-09-04T23:57:07Z")

</div>

I know that, but in there is a continuous loop of this, the sprite passes through the other 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 4, 2020, 11:59pm UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/12 "2020-09-04T23:59:37Z")

</div>

Sorry, I don’t really get it ☹

---

<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, 12:00am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/13 "2020-09-05T00:00:41Z")

</div>

It keeps on moving slowly. This happens because of resetting the movement and the time taken.

---

<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, 12:03am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/14 "2020-09-05T00:03:23Z")

</div>

Still don’t get it ☹

---

<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, 12:03am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/15 "2020-09-05T00:03:37Z")

</div>

It’s fine.

---

<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, 12:04am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/16 "2020-09-05T00:04:22Z")

</div>

What are you trying to achieve in your game?

---

<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, 12:05am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/17 "2020-09-05T00:05:03Z")

</div>

The player has to try to solve a puzzle of moving objects out of the way.

---

<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, 12:06am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/18 "2020-09-05T00:06:01Z")

</div>

It’s fine, I got an idea that works.

---

<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, 12:08am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/19 "2020-09-05T00:08:03Z")

</div>

Oops, it doesn’t work anymore.

---

<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, 1:55am UTC](https://forum.makecode.com/t/stopping-a-sprite/3363/20 "2020-09-05T01:55:45Z")

</div>

there was never a velocity set on the sprite which is why it doesnt stop.

> **[example (Dreadmask197)](https://arcade.makecode.com/42379-73629-29030-70931)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

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