# Is it possible to make a sprite react to being over a certain tile color

**URL:** <https://forum.makecode.com/t/is-it-possible-to-make-a-sprite-react-to-being-over-a-certain-tile-color/30524>\
**Category:** Help\
**Created:** [September 10, 2024, 11:53pm UTC](https://forum.makecode.com/t/is-it-possible-to-make-a-sprite-react-to-being-over-a-certain-tile-color/30524 "2024-09-10T23:53:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![codecat1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codecat1/32/29634_2.png) [@codecat1](https://forum.makecode.com/u/codecat1)\
**Post date:** [September 10, 2024, 11:53pm UTC](https://forum.makecode.com/t/is-it-possible-to-make-a-sprite-react-to-being-over-a-certain-tile-color/30524/1 "2024-09-10T23:53:10Z")

</div>

hello. I’m new here. I have been using makecode for a while now, but just now became old enough to use the forums. I’ve been wondering if there is a way to make a sprite react to a certain color that its on. Like, if a sprite is on a green part of a tilemap you could move freely, but if the said sprite is on a brown part of a tile, your gravity would increase and you would start falling. If there’s not a way can you tell me if there is a substitute. thanks.

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [September 11, 2024, 3:39am UTC](https://forum.makecode.com/t/is-it-possible-to-make-a-sprite-react-to-being-over-a-certain-tile-color/30524/2 "2024-09-11T03:39:00Z")

</div>

The most efficient solution would be to create an array of all the green tiles and another of all the brown ones, then check if a sprite overlaps a tile in either array and apply the effect. If you mean brown and green on the same 16x16 tile, then you might have to map the players X and Y to the tile they’re on and checking the color matches up, but I can go into more detail later if that is what you need!

---

<div class="post-metadata">

**Author:** ![codecat1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codecat1/32/29634_2.png) [@codecat1](https://forum.makecode.com/u/codecat1)\
**Post date:** [September 11, 2024, 2:39pm UTC](https://forum.makecode.com/t/is-it-possible-to-make-a-sprite-react-to-being-over-a-certain-tile-color/30524/3 "2024-09-11T14:39:36Z")

</div>

Thanks @randomuser , you were a big help!

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [September 11, 2024, 7:58pm UTC](https://forum.makecode.com/t/is-it-possible-to-make-a-sprite-react-to-being-over-a-certain-tile-color/30524/4 "2024-09-11T19:58:33Z")

</div>

No problem! I’m glad I could help! 💖
