@Override
	protected Point2D calculateControl(GObject target, Context context) {
		// Create variables to check for horizontal and vertical movement.
		int horizontal = 0;
		int vertical = 0;

		// Check the context for relevant keys.
		for (Integer i : context.getKeyCodesPressed()) {
			// Check the code.

			if (i.equals(controlScheme.up)) {
				// We want to go up. That's -Y.
				vertical--;
			}
			if (i.equals(controlScheme.dn)) {
				// We want to go down. That's +Y.
				vertical++;
			}
			if (i.equals(controlScheme.rt)) {
				// We want to go right. That's +X.
				horizontal++;
			}
			if (i.equals(controlScheme.lt)) {
				// We want to go left. That's -X.
				horizontal--;
			}
		}

		// Follow the rules.
		if (!verticalAllowed) {
			vertical = 0;
		}
		if (!horizontalAllowed) {
			horizontal = 0;
		}

		// Find the speed.
		double speed = getMaxSpeed();

		// Are we in both directions?
		if (horizontal > 0 && vertical > 0) {
			// We want to compensate for that. Pythagoras's theorem gives us:
			speed /= Math.sqrt(2);
		}

		return new Point2D.Double(speed * horizontal, speed * vertical);
	}