Grade12Programs/src/game/Input.java
public static void initKeys() {
        Draw.frame.addKeyListener(new KeyListener() {
            @Override
            public void keyPressed(KeyEvent e) {
                if (e.getKeyCode() <= 256) {
                    keyInputs[e.getKeyCode()] = 2;
                }
            }

            @Override
            public void keyReleased(KeyEvent e) {
                if (e.getKeyCode() <= 256) {
                    keyInputs[e.getKeyCode()] = 0;
                }
            }

            @Override
            public void keyTyped(KeyEvent e) {
            }
        });

        // Initialize input array 
        for (int i = 0; i < keyInputs.length; i++) {
            keyInputs[i] = 0;
        }
    }
// adds key input listeners to panel
adds key input listeners to panel
adds key input listeners to panel
public static void initKeys() {
        Draw.frame.addKeyListener(new KeyListener() {
            @Override
            public void keyPressed(KeyEvent e) {
                if (e.getKeyCode() <= 256) {
                    keyInputs[e.getKeyCode()] = 2;
                }
            }
            @Override
            public void keyReleased(KeyEvent e) {
                if (e.getKeyCode() <= 256) {
                    keyInputs[e.getKeyCode()] = 0;
                }
            }
            @Override
            public void keyTyped(KeyEvent e) {
            }
        });
        for (int i = 0; i < keyInputs.length; i++) {
            keyInputs[i] = 0;
        }
    }
public static void initKeys ( ) { Draw . frame . addKeyListener ( new KeyListener ( ) { @ Override public void keyPressed ( KeyEvent e ) { if ( e . getKeyCode ( ) <= 256 ) { keyInputs [ e . getKeyCode ( ) ] = 2 ; } } @ Override public void keyReleased ( KeyEvent e ) { if ( e . getKeyCode ( ) <= 256 ) { keyInputs [ e . getKeyCode ( ) ] = 0 ; } } @ Override public void keyTyped ( KeyEvent e ) { } } ) ; for ( int i = 0 ; i < keyInputs . length ; i ++ ) { keyInputs [ i ] = 0 ; } }
adds key input listeners to panel
adds key input listeners to panel
// Initialize input array 