Sharing a Keyboard

The first bug has to do with powering up the launcher. If player #1 holds down the S key, the launcher powers up like normal. But, if player #2 then presses the K key, player #1’s power up stops.

This bug happens because there’s only one keyboard and keyboards expect that only one person is going to press and hold a key. If you press and hold the S key in a word processor, you’ll get a bunch of Ss in your document—the keyboard repeats the S letter. If you keep the S key down and then hold down the K key at the same time, the computer figures you now want a bunch of Ks added to the document, and switches to repeating the K key.

To make power-ups work when two people are sharing the keyboard, we need to replace keyboard ...

Get 3D Game Programming for Kids, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.