This commit is contained in:
Luan Nico
2020-09-27 15:10:42 -04:00
parent 91c271ce30
commit a6023f4cfe
5 changed files with 27 additions and 23 deletions

View File

@ -18,7 +18,7 @@ class MyGame extends Game with ScrollDetector {
@override
void onScroll(event) {
target = position.minus(event.scrollDelta.toVector2());
target = position - event.scrollDelta.toVector2();
}
@override
@ -38,7 +38,7 @@ class MyGame extends Game with ScrollDetector {
void update(double dt) {
if (target != null) {
final dir = (target - position).normalize();
position += dir.times(SPEED * dt);
position += dir * (SPEED * dt);
}
}
}