onJoystickChangeDirectional method

  1. @override
void onJoystickChangeDirectional(
  1. JoystickDirectionalEvent event
)
override

Implementation

@override
void onJoystickChangeDirectional(JoystickDirectionalEvent event) {
  JoystickMoveDirectional newDirectional = JoystickMoveDirectional.IDLE;

  if (event.directional.isRight) {
    newDirectional = JoystickMoveDirectional.MOVE_RIGHT;
  } else if (event.directional.isLeft) {
    newDirectional = JoystickMoveDirectional.MOVE_LEFT;
  }

  super.onJoystickChangeDirectional(
    event.copyWith(
      directional: newDirectional,
    ),
  );
}