update method

  1. @override
void update()
override

Implementation

@override
void update() {
  position.add(velocity);
  if (position.x > area.width || position.x < 0) {
    velocity = -velocity;
  }
  if (position.y > area.height || position.y < 0) {
    velocity = -velocity;
  }
}