# Tilemap a star

**URL:** <https://forum.makecode.com/t/tilemap-a-star/35973>\
**Category:** Help\
**Tags:** extension\
**Created:** [April 21, 2025, 1:08am UTC](https://forum.makecode.com/t/tilemap-a-star/35973 "2025-04-21T01:08:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BotWarrior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/botwarrior/32/25328_2.png) [@BotWarrior](https://forum.makecode.com/u/BotWarrior)\
**Post date:** [April 21, 2025, 1:08am UTC](https://forum.makecode.com/t/tilemap-a-star/35973/1 "2025-04-21T01:08:27Z")

</div>

Ok. So I am maybe making a turn based game. This is what I have so far.

> **[roguelike](https://arcade.makecode.com/S59286-30261-78199-68117)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

The idea is to use mouse to select sprites and have them move to a location using tilemap a star. The only problem with this is that I want to find the distance from my character to the mouse and say how many moves it would take me to get there. I am trying to do this code in the on mouse move say (distance). How would I get the distance on the optimal path, a

---

<div class="post-metadata">

**Author:** ![Stickman4269](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/stickman4269/32/23582_2.png) [@Stickman4269](https://forum.makecode.com/u/Stickman4269)\
**Post date:** [May 1, 2025, 3:36pm UTC](https://forum.makecode.com/t/tilemap-a-star/35973/2 "2025-05-01T15:36:23Z")

</div>

I would probably tell an invisible sprite to follow the mouse and add one to a variable every time it goes to a different tile, then run the say block when it reaches the destination. This may be a terrible solution but this seems like the only one.
