When using Phaser 3 with typescript I want to call
Phaser.Actions.Call(this.enemies.getChildren(), function (this: MainScene, enemy: Phaser.GameObjects.Sprite) {
But the callback of Actions call errors because it needs Phaser.GameObjects.GameObject, even dough Phaser.GameObjects.Sprite extends Phaser.GameObjects.GameObject what am I missing.
Phaser.Actions.Call(
this.enemies.getChildren(),
function (this: MainScene, enemy: Phaser.GameObjects.GameObject) {
// […]
(enemy as Phaser.GameObjects.Sprite).velocity = direction * speed;
},
this
);