update method
Implementation
@override
void update() {
position.add(velocity);
var distance = basePosition.distanceTo(position);
if (distance > 50 || distance <= -50) {
velocity = -velocity;
}
}
@override
void update() {
position.add(velocity);
var distance = basePosition.distanceTo(position);
if (distance > 50 || distance <= -50) {
velocity = -velocity;
}
}