# P5.js movement logic — detective stops unexpectedly at corners in maze game

**URL:** https://discourse.processing.org/t/p5-js-movement-logic-detective-stops-unexpectedly-at-corners-in-maze-game/46605
**Category:** Coding Questions
**Created:** [June 25, 2025, 10:25am UTC](https://discourse.processing.org/t/p5-js-movement-logic-detective-stops-unexpectedly-at-corners-in-maze-game/46605 "2025-06-25T10:25:21Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![ProcessingOrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/processingorg/32/18341_2.png) [@ProcessingOrg](https://discourse.processing.org/u/ProcessingOrg)
#### Post date: [June 25, 2025, 10:32am UTC](https://discourse.processing.org/t/p5-js-movement-logic-detective-stops-unexpectedly-at-corners-in-maze-game/46605/2 "2025-06-25T10:32:47Z")

</div>

Welcome to the forum, and thanks for your first post!

I moved it to a more relevant category so others can find it more easily. I also formatted the code to make it easier to read. You can check out [this short guide](https://discourse.processing.org/t/guidelines-asking-questions/2147#p-7666-is-your-post-formatted-9) or the animation below for tips on formatting code in future posts.

Glad to have you here!

Raphaël

![A screen recording showing how to format code on Discourse](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/3/4/34521338de6902479873291389bf53a11d12237d.gif)

---

_[View the full topic](https://discourse.processing.org/t/p5-js-movement-logic-detective-stops-unexpectedly-at-corners-in-maze-game/46605)._
