# Simultaneous movement not working \*Resolved\*

**URL:** <https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790>\
**Category:** Coding and Debugging Help\
**Created:** [December 11, 2023, 7:08pm UTC](https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790 "2023-12-11T19:08:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![obrienm](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@obrienm](https://forum.code.org/u/obrienm)\
**Post date:** [December 11, 2023, 7:08pm UTC](https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790/1 "2023-12-11T19:08:29Z")

</div>

**Link to the project or level:** ([Game Lab - Code.org](https://studio.code.org/projects/gamelab/wmEJQas_quaHPWhvxZz6RD6VPYYAyeI1l1bKD194SPM))  
**What I expect to happen:** In a 2 player game, one player is controlled by wasd and the other by arrows. Player 1 spins their bat by pressing e, player 2 spins by pressing L. Both people should be able to move all directions and spin their bats.  
**What actually happens:** The players can move fine, except if they move to the right. If player 1 is spinning and moving right, player 2 can’t move or spin. If player 2 is spinning, player 1 can’t spin and move to the right.  
**What I’ve tried:** i’ve gone over the code looking for discrepancies in x and y position, and \< or \> being in the wrong place. I can’t see any conflict.

> **[Check out what I made](https://studio.code.org/projects/gamelab/wmEJQas_quaHPWhvxZz6RD6VPYYAyeI1l1bKD194SPM)**
>
> I wrote the code myself with Code.org

---

<div class="post-metadata">

**Author:** ![varrience](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/varrience/32/8042_2.png) [@varrience](https://forum.code.org/u/varrience)\
**Post date:** [December 12, 2023, 12:41am UTC](https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790/2 "2023-12-12T00:41:43Z")

</div>

movement seems fine to me couldn’t replicate your bug maybe you fixed it? the only bug i saw was the rotation being set to 0 rather than keeping the relative rotation

```auto
function fight() {
  if (keyDown ("e")) {
    bat1.rotationSpeed = 25;
    bat1.setAnimation("bat1hit");
  } else {
    bat1.rotationSpeed = 0;
  }
  
}
function fight1() {
    if (keyDown ("l")) {
    bat2.rotationSpeed = 25;
    bat2.setAnimation("bat2hit");
  } else {
    bat2.rotationSpeed = 0;
  }
  
}

```

---

<div class="post-metadata">

**Author:** ![obrienm](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@obrienm](https://forum.code.org/u/obrienm)\
**Post date:** [December 12, 2023, 1:16pm UTC](https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790/3 "2023-12-12T13:16:55Z")

</div>

Thanks for pointing out the bug. The code is from a student of mine, and hasn’t been fixed yet. If you push e, then l, then d, the first player should move right, but doesn’t.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [December 12, 2023, 6:11pm UTC](https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790/4 "2023-12-12T18:11:22Z")

</div>

@obrienm,

As i am looking at it right now, the controls have changed to different keys and it appears that both players can move and swing the bat at the same time. Let us know if you still need someone to look at it.

Mike

---

<div class="post-metadata">

**Author:** ![obrienm](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@obrienm](https://forum.code.org/u/obrienm)\
**Post date:** [December 12, 2023, 6:38pm UTC](https://forum.code.org/t/simultaneous-movement-not-working-resolved/38790/5 "2023-12-12T18:38:31Z")

</div>

Yeah, he made some changes in class today, and it works now. I’m not sure what the issue was. Thanks for looking.
