# How to make sprites not able to be walked through using blocks?

**URL:** <https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034>\
**Category:** Help\
**Tags:** game\
**Created:** [November 6, 2023, 7:22pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034 "2023-11-06T19:22:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![techman-5307](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/techman-5307/32/11659_2.png) [@techman-5307](https://forum.makecode.com/u/techman-5307)\
**Post date:** [November 6, 2023, 7:22pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/1 "2023-11-06T19:22:58Z")

</div>

I want to set up something where the player can’t walk through certain projectiles. Below is my current code that only works for the left side of blocking and occasionally the top side/bottom side.

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

---

<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:** [November 6, 2023, 7:49pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/2 "2023-11-06T19:49:06Z")

</div>

One thing to keep in mind is the speed of the player. If the player moves with 100vx 100vy, the opposing velocity should be higher so it works.

---

<div class="post-metadata">

**Author:** ![techman-5307](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/techman-5307/32/11659_2.png) [@techman-5307](https://forum.makecode.com/u/techman-5307)\
**Post date:** [November 6, 2023, 10:29pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/3 "2023-11-06T22:29:17Z")

</div>

I tried what you said but it didn’t work. In the time I was waiting for a response, I wrote new code that mostly worked, but when the player collides with the top it pushes them off the top as the side collision code is running.

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

---

<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:** [November 6, 2023, 11:44pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/4 "2023-11-06T23:44:02Z")

</div>

Can you send the code?

---

<div class="post-metadata">

**Author:** ![techman-5307](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/techman-5307/32/11659_2.png) [@techman-5307](https://forum.makecode.com/u/techman-5307)\
**Post date:** [November 7, 2023, 5:54am UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/5 "2023-11-07T05:54:07Z")

</div>

The whole code?

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [November 7, 2023, 5:19pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/6 "2023-11-07T17:19:33Z")

</div>

> [@Luke](#):
>
> …the opposing velocity should be higher so it works.

Is what you are saying here somewhat related to this, @Luke?:

> [@Effect of different widths on overlapping features, what am I doing wrong?](https://forum.makecode.com/t/effect-of-different-widths-on-overlapping-features-what-am-i-doing-wrong/22161):
>
> In my game, I have three differently-sized pink straight-line sprites: one with a size of 1x16, one with a size of 1x120, and the otherwith a size of 2x120. However, I’m encountering an issue where the ‘overlaps’ function doesn’t work when my sprite size is 1x120. But when I create sprites with sizes 1x16 and 2x120, the ‘overlaps’ function does work. [image] What I want is for the ‘overlaps’ function to destroy the overlapped ‘badGuy’ whenever any size of player sprite overlaps it.…

---

<div class="post-metadata">

**Author:** ![Sonicblaston](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sonicblaston/32/19164_2.png) [@Sonicblaston](https://forum.makecode.com/u/Sonicblaston)\
**Post date:** [November 7, 2023, 5:20pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/7 "2023-11-07T17:20:24Z")

</div>

Just share the link by pressing this button in the top right corner

 ![IMG_1214](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/c227b43f3c8e2d3385469544538b2731ee40ab1e.jpeg)

---

<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:** [November 7, 2023, 6:27pm UTC](https://forum.makecode.com/t/how-to-make-sprites-not-able-to-be-walked-through-using-blocks/24034/8 "2023-11-07T18:27:19Z")

</div>

I was trying to say that the velocity applied to the player should be higher so it counteracts any player inputs.
