public void keyReleased(KeyEvent key) { if (key.getKeyCode() == 37) { leftcheck = false; if (rightcheck) { player.ta = changet; } else { player.ta = 0; } } if (key.getKeyCode() == 39) { rightcheck = false; if (leftcheck) { player.ta = -changet; } else { player.ta = 0; } } if (key.getKeyCode() == 32) { grav = false; } }
public void keyPressed(KeyEvent key) { if (key.getKeyCode() == 37) { leftcheck = true; player.ta = -changet; } if (key.getKeyCode() == 39) { rightcheck = true; player.ta = changet; } if (key.getKeyCode() == 32) { grav = true; } }