fSize from the digitsensitive's Snake game example

Hello.

Phaser.Types.GameObjects.Graphics.Options does not have the “fSize” field:

fSizeAndGraphicsOptions

It is from the digitsensitive’s Snake game example: https://github.com/digitsensitive/phaser3-typescript/blob/master/src/games/snake/objects/apple.ts

export class Apple extends Phaser.GameObjects.Graphics {
  constructor(scene, params) {
    super(scene, params);
    this.x = params.xPos;
    this.y = params.yPos;
    this.fillStyle(0x61e85b, 0.8);
    this.fillRect(params.fSize, params.fSize, params.fSize, params.fSize);
    this.scene.add.existing(this);
  }

It looks like a custom addition. Phaser doesn’t use fSize anywhere. The correct type would be Phaser.Types.GameObjects.Graphics.Options & {fSize: number}, or better yet, an interface that extends Phaser.Types.GameObjects.Graphics.Options and adds fSize: number.

1 Like