# Obstacle with a Sprite

**URL:** https://forum.makecode.com/t/obstacle-with-a-sprite/30471
**Category:** Help
**Created:** [September 7, 2024, 10:50pm UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471 "2024-09-07T22:50:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![AlexNotFoundBNDS](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@AlexNotFoundBNDS](https://forum.makecode.com/u/AlexNotFoundBNDS)
#### Post date: [September 7, 2024, 10:50pm UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471/1 "2024-09-07T22:50:18Z")

</div>

I’m making an RPG game now and there is some furniture( **sprites** ) in my game.

I had already made a hitbox for the player.

The problem is I don’t want the player go through the furniture, but I found that the wall in tilemap doesn’t works well. The wall is always a bit bigger or smaller than I need.

Is there a nice way to make a **sprite** works like a **wall**?

---

<div class="post-metadata">

### Author: ![RobbyZero](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robbyzero/32/17188_2.png) [@RobbyZero](https://forum.makecode.com/u/RobbyZero)
#### Post date: [September 7, 2024, 10:56pm UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471/2 "2024-09-07T22:56:10Z")

</div>

You could use the on sprite of kind player overlaps other sprite of kind enemy to set the location of player to just outside it every time

---

<div class="post-metadata">

### Author: ![AlexNotFoundBNDS](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@AlexNotFoundBNDS](https://forum.makecode.com/u/AlexNotFoundBNDS)
#### Post date: [September 8, 2024, 3:07am UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471/3 "2024-09-08T03:07:41Z")

</div>

But it’s hard (maybe for me) to check the **collision direction** so I cant figure how to set the location to outside ☹

---

<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: [September 8, 2024, 6:15pm UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471/4 "2024-09-08T18:15:59Z")

</div>

You can just use the player velocityX and Y to tell the direction. It doesn’t look very good though 🫤  
[https://makecode.com/\_fEH6A7CDo46b](https://makecode.com/_fEH6A7CDo46b)

---

<div class="post-metadata">

### Author: ![AlexNotFoundBNDS](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@AlexNotFoundBNDS](https://forum.makecode.com/u/AlexNotFoundBNDS)
#### Post date: [September 9, 2024, 2:47pm UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471/5 "2024-09-09T14:47:49Z")

</div>

Finally, I solved this problem with adding 4 **hitrods** in 4 directions to detect the **collision direction** with furnitures. I also added hitboxes for furnitures to make collision looks naturally.  
tks for u guys for your useful advice 🙂

---

<div class="post-metadata">

### Author: ![msunar0](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@msunar0](https://forum.makecode.com/u/msunar0)
#### Post date: [March 12, 2026, 4:41pm UTC](https://forum.makecode.com/t/obstacle-with-a-sprite/30471/6 "2026-03-12T16:41:32Z")

</div>

How did you do that? can I see your code I’m trying to do the same thing!
