# How to stop a image from following the mouse

**URL:** <https://forum.code.org/t/how-to-stop-a-image-from-following-the-mouse/38845>\
**Category:** Uncategorized\
**Created:** [January 2, 2024, 5:26pm UTC](https://forum.code.org/t/how-to-stop-a-image-from-following-the-mouse/38845 "2024-01-02T17:26:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spoonrogers](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@spoonrogers](https://forum.code.org/u/spoonrogers)\
**Post date:** [January 2, 2024, 5:26pm UTC](https://forum.code.org/t/how-to-stop-a-image-from-following-the-mouse/38845/1 "2024-01-02T17:26:13Z")

</div>

This is the code I have so far, when I click on “BlackJackImageHighlighed” twice it follows the mouse. I don’t know how to stop the image from following the mouse after clicking the “screen1”. Also when I would click on “screen1” I want the image to stay where I clicked"

 ![Screenshot 2024-01-02 12.21.23 PM](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/2/2d45b0626c0a5792be6ab6165215ace6ac9c3f3d.png)

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [January 4, 2024, 11:38pm UTC](https://forum.code.org/t/how-to-stop-a-image-from-following-the-mouse/38845/2 "2024-01-04T23:38:40Z")

</div>

Hi @spoonrogers,

Super cool way to capture the x and y of the mouse in App Lab.  
I experimented with what I think your objective is [HERE](https://studio.code.org/projects/applab/g8xPYHBlRU8os9kQ4KI2f47XKOLFJIpt7zJnSoa_Yw0). Instead of nested events, I used variables to determine if the button moves or stays. Not sure if this is what you were asking.

Hope you will share your final game:)

~Michelle

---

<div class="post-metadata">

**Author:** ![spoonrogers](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@spoonrogers](https://forum.code.org/u/spoonrogers)\
**Post date:** [January 5, 2024, 2:34pm UTC](https://forum.code.org/t/how-to-stop-a-image-from-following-the-mouse/38845/3 "2024-01-05T14:34:47Z")

</div>

Thank you, this is perfect for what I am looking for. I had to re-write all of it, it was very unorganized.
