update method

dynamic update({
  1. bool? y,
  2. bool? x,
})

Implementation

update({bool? y, bool? x}) {
  if (y != null || x != null) {
    _buildVelocity(y: y, x: x);
  }
  position += velocity;
  if (position.dx < 0 || position.dx > maxWidth || position.dy < 0 || position.dy > maxHeight) {
    reset();
  }
}