# How to Make a Sprite Move Back and Forth (like a sentinel) in a platform game

**URL:** https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686
**Category:** Help
**Created:** [June 26, 2026, 4:42pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686 "2026-06-26T16:42:28Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![anna4github](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/anna4github/32/31474_2.png) [@anna4github](https://forum.makecode.com/u/anna4github)
#### Post date: [June 26, 2026, 4:42pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/1 "2026-06-26T16:42:28Z")

</div>

Hi,

Just want to ask what are the blocks that I need to use to make a sprite move back and forth (like a sentinel) in a platform game? For example, this sprite should move to far right of the platform and then turn around and move to the far left of the platform, then go back and forth…

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

---

<div class="post-metadata">

### Author: ![ScriptScraper](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/scriptscraper/32/35438_2.png) [@ScriptScraper](https://forum.makecode.com/u/ScriptScraper)
#### Post date: [June 26, 2026, 5:27pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/2 "2026-06-26T17:27:38Z")

</div>

you can use the tilemap location of the sprite in the scene category to check if the next tile it walks on is empty or not

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [June 26, 2026, 5:28pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/3 "2026-06-26T17:28:00Z")

</div>

you mean, like this?

> **[red-koopa-example](https://arcade.makecode.com/S48668-22015-28243-84773)**
>
> An example of platformer enemies that turn left and right on the edges of platforms. Y'know, like red koopas from mario

comments are in the project!

---

<div class="post-metadata">

### Author: ![NeverStopTheCoder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/neverstopthecoder/32/21194_2.png) [@NeverStopTheCoder](https://forum.makecode.com/u/NeverStopTheCoder)
#### Post date: [June 27, 2026, 4:29pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/4 "2026-06-27T16:29:04Z")

</div>

**[https://github.com/neverstopthecoder/moving-extension](https://github.com/neverstopthecoder/moving-extension)** yes try this extension I made

---

<div class="post-metadata">

### Author: ![anna4github](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/anna4github/32/31474_2.png) [@anna4github](https://forum.makecode.com/u/anna4github)
#### Post date: [June 27, 2026, 9:34pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/5 "2026-06-27T21:34:27Z")

</div>

Thanks. This lesson is for Year 7s, is there a simpler way of doing these codes?

---

<div class="post-metadata">

### Author: ![NeverStopTheCoder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/neverstopthecoder/32/21194_2.png) [@NeverStopTheCoder](https://forum.makecode.com/u/NeverStopTheCoder)
#### Post date: [June 27, 2026, 11:49pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/6 "2026-06-27T23:49:05Z")

</div>

why yes (ahem cough.. cough.. extension above) although I forgot to mention its not perfect but it does work

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [June 29, 2026, 6:37pm UTC](https://forum.makecode.com/t/how-to-make-a-sprite-move-back-and-forth-like-a-sentinel-in-a-platform-game/44686/7 "2026-06-29T18:37:27Z")

</div>

> **[red-koopa-simple](https://arcade.makecode.com/S63825-40537-29442-40948)**
>
> An example of platformer enemies that turn left and right on the edges of platforms. Y'know, like red koopas from mario

here’s a simpler version, but it’s not as flexible. this one uses the bounce on wall flag to make it so that the flipping direction happens automatically, but that means you need to place the enemy between two walls in your tilemap or they’ll fly around
