Hi I’m making a game with phaser where the player has to move left, centre and right to avoid and grab items that come down from the top.
However, on my mobile device, whenever I touch the player to move them, the items that are coming down with velocity.y are jerking once in a while.
It’s like flickering or stuttering.
Does anyone know how to fix this?
I’m currently looking at the forums
antialiasGL: false,batchSize: 512, but that didn’t work.
The version of phaser I’m using is 3.80.1, and I’m developing in Next.js.
create() {
this.input.on('pointerdown', this.handlePointerDown, this);
}
update(time: any, delta: any) {
this.itemSpawnDelay = this.isInvincible ? 300 : 1000;
if (time - this.lastItemSpawnTime > this.itemSpawnDelay) {
this.spawnItem();
this.lastItemSpawnTime = time;
}
}
spawnItem() {
if (this.gameFinished) return;
const randomPosition = Phaser.Math.RND.pick([this.positions.left, this.positions.center, this.positions.right]);
const randomItemKey = Phaser.Math.RND.pick(['globefish', 'rock', 'shark', 'wave']);
const item = this.items?.create(randomPosition, 0, randomItemKey).setScale(this.devicePixelRatio / 3);
if (this.isInvincible) {
item.body.velocity.y = this.fastSpeed;
} else {
item.body.velocity.y = this.normalSpeed;
}
}