Skip to content

Commit afbc8e2

Browse files
committed
adding duration threshold for camera move event
1 parent 9624444 commit afbc8e2

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

base/game_events/CameraMoveEvent.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,24 @@ export class CameraMoveEvent extends GameEvent {
5252
const easing = point.easing ? _.get(Phaser.Easing, point.easing) : Phaser.Easing.Linear.None;
5353
let promise_resolve;
5454
const promise = new Promise(resolve => (promise_resolve = resolve));
55-
this.game.add
56-
.tween(this.game.camera)
57-
.to(
58-
{
59-
x: x,
60-
y: y,
61-
},
62-
duration,
63-
easing,
64-
true
65-
)
66-
.onComplete.addOnce(promise_resolve);
55+
if (duration >= 30) {
56+
this.game.add
57+
.tween(this.game.camera)
58+
.to(
59+
{
60+
x: x,
61+
y: y,
62+
},
63+
duration,
64+
easing,
65+
true
66+
)
67+
.onComplete.addOnce(promise_resolve);
68+
} else {
69+
this.game.camera.x = x;
70+
this.game.camera.y = y;
71+
promise_resolve();
72+
}
6773
await promise;
6874
}
6975
if (this.reset_follow && camera_was_following) {

0 commit comments

Comments
 (0)