# Hero randomly moving

**URL:** <https://discourse.codecombat.com/t/hero-randomly-moving/32672>\
**Category:** Bugs\
**Created:** [April 17, 2022, 2:42pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672 "2022-04-17T14:42:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [April 17, 2022, 2:42pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/1 "2022-04-17T14:42:03Z")

</div>

I have only 1 `hero.move` or `hero.moveXY` in my code, but my hero is randomly moving, why?  
 ![Screenshot 2022-04-17 09.38.00](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/f/6/f65029b12e84a0a20f880c08c4f193ba9a677c99.png)  
I literally used ctrl+f to check for `hero.move` (which also covers `hero.moveXY` because it contains `hero.move`) but found none except for 5 in comments and 1 that sometimes makes me change my y by 10, none that make me change my x…

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [April 17, 2022, 2:43pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/2 "2022-04-17T14:43:12Z")

</div>

I don’t have any `hero.attack` either, and `hero.buildXY` uses the hero’s position

---

<div class="post-metadata">

**Author:** ![PeterPalov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/peterpalov/32/45280_2.png) [@PeterPalov](https://discourse.codecombat.com/u/PeterPalov)\
**Post date:** [April 17, 2022, 4:15pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/3 "2022-04-17T16:15:46Z")

</div>

Maybe because you got “bugged” when enemy hero casted invisibility and the enemy hero was your target?

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [April 17, 2022, 4:54pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/4 "2022-04-17T16:54:59Z")

</div>

But as I said, I don’t have any `hero.attack`…

---

<div class="post-metadata">

**Author:** ![PeterPalov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/peterpalov/32/45280_2.png) [@PeterPalov](https://discourse.codecombat.com/u/PeterPalov)\
**Post date:** [April 17, 2022, 4:56pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/5 "2022-04-17T16:56:32Z")

</div>

It’s not necessary the attack. It can be a cast for enemy hero or a bear-trap or a fire-trap, a decoy on the enemy hero position and things like that.

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [April 17, 2022, 4:57pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/6 "2022-04-17T16:57:58Z")

</div>

It says I don’t have a target while I’m moving though…

---

<div class="post-metadata">

**Author:** ![PeterPalov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/peterpalov/32/45280_2.png) [@PeterPalov](https://discourse.codecombat.com/u/PeterPalov)\
**Post date:** [April 17, 2022, 5:00pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/7 "2022-04-17T17:00:36Z")

</div>

Well, you don’t have it because you already got bugged…

---

<div class="post-metadata">

**Author:** ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)\
**Post date:** [April 17, 2022, 5:02pm UTC](https://discourse.codecombat.com/t/hero-randomly-moving/32672/8 "2022-04-17T17:02:01Z")

</div>

Hmmm, oh yeah, I remember casting invisibility on myself and bugging the opponent once, wait, let me see if I can fix it, but still, even if its because of invisibility, it needs to be fixed 😕
