# Stun Function?

**URL:** <https://forum.makecode.com/t/stun-function/22642>\
**Category:** Help\
**Tags:** game, graphics-and-math\
**Created:** [September 20, 2023, 9:07pm UTC](https://forum.makecode.com/t/stun-function/22642 "2023-09-20T21:07:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Computedduke586](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Computedduke586](https://forum.makecode.com/u/Computedduke586)\
**Post date:** [September 20, 2023, 9:07pm UTC](https://forum.makecode.com/t/stun-function/22642/1 "2023-09-20T21:07:09Z")

</div>

Is there a way to make my character be stunned for a few seconds when on impact with a porjectile?

---

<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:** [September 20, 2023, 9:50pm UTC](https://forum.makecode.com/t/stun-function/22642/2 "2023-09-20T21:50:08Z")

</div>

Stop the player movement by setting the move sprite with speed to 0  
After desired stun time move player again

---

<div class="post-metadata">

**Author:** ![Mega0star01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mega0star01/32/14784_2.png) [@Mega0star01](https://forum.makecode.com/u/Mega0star01)\
**Post date:** [September 20, 2023, 10:00pm UTC](https://forum.makecode.com/t/stun-function/22642/3 "2023-09-20T22:00:04Z")

</div>

i normally do what @Luke says and i use timers extension, if you want to make the character incapable of doing anything you can also use a variable called stun and do: on sprite of kind projectile overlaps other sprite of kind player: set stun to 1, after action (number) Ms (miliseconds): set stun to 0.  
i am using this for two games i’m doing.

---

<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:** [September 21, 2023, 5:52pm UTC](https://forum.makecode.com/t/stun-function/22642/4 "2023-09-21T17:52:06Z")

</div>

There is a true/false bool (which could be easier to use and understand)

---

<div class="post-metadata">

**Author:** ![Mega0star01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mega0star01/32/14784_2.png) [@Mega0star01](https://forum.makecode.com/u/Mega0star01)\
**Post date:** [October 16, 2023, 7:05pm UTC](https://forum.makecode.com/t/stun-function/22642/5 "2023-10-16T19:05:55Z")

</div>

just realized that i can use true and false 😅
