public void keyPressed(KeyEvent e){

		if (e.getKeyCode() == KeyEvent.VK_RIGHT){
			ship.setDir(1, ship.getYDir());
		}
			
		if (e.getKeyCode() == KeyEvent.VK_LEFT){
			ship.setDir(-1,ship.getYDir());
		}
		
		if (e.getKeyCode() == KeyEvent.VK_UP){
			ship.setDir(ship.getXDir(), -1);
		}
		
		if (e.getKeyCode() == KeyEvent.VK_DOWN){
			ship.setDir(ship.getXDir(), 1);
		}
		
		if (e.getKeyCode() == KeyEvent.VK_SPACE && !reloading && bulletsLeft > 0 && lives > 0){
			machineGun.fire(ship.getX()+26, ship.getY(), -1);
			bulletsLeft--;														//avoid player from just holding space bar down
			reloading = true;													//avoid player from spamming bullets
		}
	}