[P3] Fix Substitute visual error on wave transition (#4648)
This commit is contained in:
parent
391f38c3c8
commit
470f9e4e19
|
@ -749,9 +749,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
const relX = newOffset[0] - initialOffset[0];
|
const relX = newOffset[0] - initialOffset[0];
|
||||||
const relY = newOffset[1] - initialOffset[1];
|
const relY = newOffset[1] - initialOffset[1];
|
||||||
|
|
||||||
|
const subTag = this.getTag(SubstituteTag);
|
||||||
|
|
||||||
if (duration) {
|
if (duration) {
|
||||||
|
// TODO: can this use stricter typing?
|
||||||
|
const targets: any[] = [ this ];
|
||||||
|
if (subTag?.sprite) {
|
||||||
|
targets.push(subTag.sprite);
|
||||||
|
}
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this,
|
targets: targets,
|
||||||
x: (_target, _key, value: number) => value + relX,
|
x: (_target, _key, value: number) => value + relX,
|
||||||
y: (_target, _key, value: number) => value + relY,
|
y: (_target, _key, value: number) => value + relY,
|
||||||
duration: duration,
|
duration: duration,
|
||||||
|
@ -761,6 +768,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
} else {
|
} else {
|
||||||
this.x += relX;
|
this.x += relX;
|
||||||
this.y += relY;
|
this.y += relY;
|
||||||
|
if (subTag?.sprite) {
|
||||||
|
subTag.sprite.x += relX;
|
||||||
|
subTag.sprite.y += relY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue