# Multi-player input in CSD Unit 3?

**URL:** <https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445>\
**Category:** Coding and Debugging Help\
**Tags:** csd-unit-3\
**Created:** [October 16, 2019, 12:16am UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445 "2019-10-16T00:16:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.burgess](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@andrea.burgess](https://forum.code.org/u/andrea.burgess)\
**Post date:** [October 16, 2019, 12:16am UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/1 "2019-10-16T00:16:06Z")

</div>

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

Hi - this student would like to have 2 moving sprites with input from 2 users on the same keyboard.  
Looking through the Unit 3 documentation, I’m not able to help the student with this.  
Could anyone point us in the right direction?  
Thanks so much!

---

<div class="post-metadata">

**Author:** ![edavis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/edavis/32/4927_2.png) [@edavis](https://forum.code.org/u/edavis)\
**Post date:** [October 17, 2019, 1:11am UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/2 "2019-10-17T01:11:24Z")

</div>

It looks like they are headed in the right direction. Right now they’ve only named one sprite and they haven’t given it any inputs. If they create a second sprite and maybe use the arrow key inputs for one sprite and WASD inputs for the other, then they could have two users on the same keyboard. I know that’s not super specific to the code itself, but it sounds like a great challenge for the students to tackle!

---

<div class="post-metadata">

**Author:** ![andrea.burgess](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@andrea.burgess](https://forum.code.org/u/andrea.burgess)\
**Post date:** [October 24, 2019, 12:46am UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/3 "2019-10-24T00:46:00Z")

</div>

Hi - I’m sorry, but I copied the wrong version of her code.  
This is actually what she has now

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

---

<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:** [October 24, 2019, 5:56am UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/4 "2019-10-24T05:56:30Z")

</div>

[Here’s a little help.](https://studio.code.org/projects/gamelab/OK07r9qTu0ZYeVIN4XScxwCxN2x26VfbVBN95V0z98I) I didn’t completely clean up the code, but I did move everything inside the 1st draw loop. If the conditional loop that checks for the keys to be pressed is not inside the draw loop, it will only get checked once and once only when the code runs. By moving it inside the draw loop, it is constantly being checked which I think is one of the issues your student was having.

Hope this helps a little!

Mike

---

<div class="post-metadata">

**Author:** ![andrea.burgess](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@andrea.burgess](https://forum.code.org/u/andrea.burgess)\
**Post date:** [October 25, 2019, 1:31pm UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/5 "2019-10-25T13:31:44Z")

</div>

THANK YOU SO MUCH!!!  
J

I actually love playing with this stuff but just have been swamped with the tech support part of my job lately.  
L

Was there supposed to be an attachment or a link with the changes you made to the code?

Thanks again!!

---

<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:** [October 25, 2019, 1:55pm UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/6 "2019-10-25T13:55:45Z")

</div>

The words “Here’s a little help” are hyperlinked.

🙂

Mike

---

<div class="post-metadata">

**Author:** ![andrea.burgess](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@andrea.burgess](https://forum.code.org/u/andrea.burgess)\
**Post date:** [October 25, 2019, 2:31pm UTC](https://forum.code.org/t/multi-player-input-in-csd-unit-3/31445/7 "2019-10-25T14:31:15Z")

</div>

Well don’t I feel stupid! Lol

_Andrea Burgess_

![image001.jpg](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/7/78c758929ef80a9e24eff9b873c7ca04b88c5ebd.jpeg)
