# Does anyone have a consistent way of making sprites overlap each-other like walls?

**URL:** <https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812>\
**Category:** Help\
**Tags:** game\
**Created:** [May 20, 2025, 11:27pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812 "2025-05-20T23:27:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)\
**Post date:** [May 20, 2025, 11:27pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/1 "2025-05-20T23:27:46Z")

</div>

im just trying to make collision between sprites and i am… failing i need a system for overlaps that can be applied to any sprite shape, or just.. lines (that are a few pixels thick) that go any direction.  
i am aware that this is difficult, and if nobody has a way to do it, i do have a solution, but im not sure if it will work 100% guarenteed.

also, i need the overlap to only detect where pixels are, not just the image size of the sprite.

---

<div class="post-metadata">

**Author:** ![BlueYoshi507](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blueyoshi507/32/32630_2.png) [@BlueYoshi507](https://forum.makecode.com/u/BlueYoshi507)\
**Post date:** [May 21, 2025, 8:16pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/2 "2025-05-21T20:16:16Z")

</div>

Use the Sprite Walls Engine extension 👇

> [@Sprite Walls Engine – Extension](https://forum.makecode.com/t/sprite-walls-engine-extension/33627):
>
> Sprite Walls Engine – Extension Sprite Walls Engine is an extension that allows you to use sprites as walls instead of tiles. It also includes a pushable sprite block, that lets you, well push sprites. Features Sprite-Based Collision – Use sprites as solid walls. Pushable Objects – Create objects that can be pushed by the player or other sprites. Versatile Sprite Interaction – Works with both individual sprites and SpriteKind groups. How It Works This extension uses AABB (Axis-Aligned Boun…

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [May 21, 2025, 8:16pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/3 "2025-05-21T20:16:21Z")

</div>

Oh, also @Sonicblaston made a sprite walls extension that you might want to look at if you haven’t yet. Search `Sonicblaston62/Sprite-Walls` in the extensions search bar to find it.

lol I wrote this after the message under it

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [May 21, 2025, 8:16pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/4 "2025-05-21T20:16:47Z")

</div>

“Sprite overlaps Orhersprite” blocks are based on where the pixels are, but the real problem is preventing the moving sprite from going through the other one. This can usually be done by comparing where the two sprites are and “ejecting” the other sprite by pushing it away from the solid one. This can be fairly difficult to do, however.

My best guess as to how I would do it is I would keep track of the moving sprite’s position over time, and only update this tracking position if the sprite is not touching any solid sprites, then if the sprite ever _is_ touching a solid sprite, its position gets moved a little bit at a time back towards its last saved position from when it wasn’t touching the sprite, until it’s no longer touching the sprite. Or use some math to instantly find the point where the sprites aren’t touching, but I think I would just be lazy and go with the tiny movements.

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [May 21, 2025, 8:16pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/5 "2025-05-21T20:16:53Z")

</div>

You could try using this extension from a “friend” of mine.

> [@Sprite Walls Engine – Extension](https://forum.makecode.com/t/sprite-walls-engine-extension/33627):
>
> Sprite Walls Engine – Extension Sprite Walls Engine is an extension that allows you to use sprites as walls instead of tiles. It also includes a pushable sprite block, that lets you, well push sprites. Features Sprite-Based Collision – Use sprites as solid walls. Pushable Objects – Create objects that can be pushed by the player or other sprites. Versatile Sprite Interaction – Works with both individual sprites and SpriteKind groups. How It Works This extension uses AABB (Axis-Aligned Boun…

---

<div class="post-metadata">

**Author:** ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)\
**Post date:** [May 22, 2025, 1:29am UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/6 "2025-05-22T01:29:04Z")

</div>

for everyone who is telling me to use the extension. **THIS WILL NOT WORK**

i already explained that it needs to be applied to any sprite shape, and sprite walls extension **does not support this.** i have tried it. the owner themself said they will not update the extension to support this because it is too difficult.

the way the extension currently works is through the rectangular hitbox the sprite takes up, not just where the pixels are in the sprite, and in my situation, the sprites image takes up the whole screen, but there are only pixels in part of it.

@WoofWoof 's idea is good, but for what i am trying to make, it would not work.

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [May 22, 2025, 2:44pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/7 "2025-05-22T14:44:33Z")

</div>

You said yourself you had a potential solution, yes? We don’t have any other ideas, and we aren’t going to code it for you. Might as well try the solution you have in mind!

---

<div class="post-metadata">

**Author:** ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)\
**Post date:** [May 22, 2025, 10:51pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/8 "2025-05-22T22:51:57Z")

</div>

I tried my solution. it didn’t work very well.

---

<div class="post-metadata">

**Author:** ![a012](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/a012/32/24099_2.png) [@a012](https://forum.makecode.com/u/a012)\
**Post date:** [August 29, 2025, 6:15pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/9 "2025-08-29T18:15:55Z")

</div>

can you try telling me what solution you were trying to do even if it does not work.

---

<div class="post-metadata">

**Author:** ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)\
**Post date:** [August 29, 2025, 10:05pm UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/10 "2025-08-29T22:05:52Z")

</div>

i don’t remember what my original idea was but the one that worked was detecting if the color in an image at a location relative to a sprite was a certain color, and if it was, i would push the sprite away from the position it detected the color at. it wont work for all sprites but if the “wall” sprite is being drawn with blocks from the image tab it will usually be one color and this will work well.

---

<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:** [August 30, 2025, 2:36am UTC](https://forum.makecode.com/t/does-anyone-have-a-consistent-way-of-making-sprites-overlap-each-other-like-walls/36812/11 "2025-08-30T02:36:14Z")

</div>

> [@\[Tutorial\] Making an Enemy Follow Multiple Sprites snake](https://forum.makecode.com/t/tutorial-making-an-enemy-follow-multiple-sprites/33914):
>
> The code gathers all the player-enemy distances, sorts them in an array to find the shortest distance, then for each player sprite, compares it’s distance to the shortest distance in the array to find the closest player. This player sprite is stored in the enemy sprite data and set as a follow target. All of this happens every game update so that the enemy can register a new closest player as fast as possible. The array before being sorted. After the sort, the 52.47… distance will be…

this might work^

> [@\[Tutorial\] Making an Enemy Follow Multiple Sprites snake](https://forum.makecode.com/t/tutorial-making-an-enemy-follow-multiple-sprites/33914/1):
>
> The distances are recorded to such an absurd number of precision that I’ve managed to use this method to register sprite overlaps as the default block can be quite buggy (especially when lagging or when dealing with multiple sprites)  
> Registering sprite overlaps is the same as finding the closest sprite, but it checks if the shortest distance is also short enough to be overlapping with the player.
