This.gamestate variable not recognized (phaser.js)

So I’ve been trying to replicate the tile chebyshev lab outside of the phaser lab area, in glitch, and I’ve been Using the variable solution I got in this answer about using Phaser.gamestate for my variable that need to be update in many locations

And my Console hits me with Cannot read properties of undefined (reading 'gameState')

I’ve tried the this context setting too, but it continues this error, what can I do to fix it?

My Code:

import Phaser from "../lib/phaser.js";

export default class Game extends Phaser.Scene {
  constructor() {
    super("game1");
  }

  preload() {
    this.load.image(
      "Tileset",
      "https://cdn.glitch.global/cc90578e-c3d0-47c5-bb0d-f5a81263b5b6/pixil-frame-0%20(17).png?v=1675985219390"
    );
    this.load.tilemapTiledJSON(
      "map",
      "https://cdn.glitch.global/cc90578e-c3d0-47c5-bb0d-f5a81263b5b6/Map.tmj?v=1675985261369"
    );
    this.load.spritesheet(
      "player",
      "https://cdn.glitch.global/cc90578e-c3d0-47c5-bb0d-f5a81263b5b6/pixil-frame-0%20(13).png?v=1675904194091",
      { frameWidth: 32, frameHeight: 32 }
    );
  }

  create() {
    this.gameState = {
      map: "",
      cursors: "",
    };

    this.gameState.map = this.make.tilemap({ key: "map" });
    this.tiles = this.gameState.map.addTilesetImage("tileSet", "Tileset");
    this.worldLayer = this.gameState.map.createLayer(
      "Block Layer",
      this.tiles,
      0,
      0
    );

    this.player = this.physics.add.sprite(0, 0, "player", 1);

    this.cameras.main.setBounds(
      0,
      0,
      this.gameState.map.widthInPixels,
      this.gameState.map.heightInPixels
    );
    this.cameras.main.startFollow(this.player);

    this.gameState.cursors = this.input.keyboard.createCursorKeys();
  }

  update() {
    function updateMap() {
      console.log(this.gameState)
      var origin = this.gameState.map.getTileAtWorldXY(
        this.player.x,
        this.player.y
      );

      this.gameState.map.forEachTile(function (tile) {
        var dist = Phaser.Math.Distance.Chebyshev(
          origin.x,
          origin.y,
          tile.x,
          tile.y
        );

        tile.setAlpha(1 - 0.1 * dist);
      }, this);
    }

    if (this.gameState.cursors.left.isDown) {
      this.player.setVelocityX(-50);
      this.player.anims.play("left", true);
    } else if (this.gameState.cursors.right.isDown) {
      this.player.setVelocityX(50);
      this.player.anims.play("right", true);
    } else if (this.gameState.cursors.up.isDown) {
      this.player.setVelocityY(-50);
    } else if (this.gameState.cursors.down.isDown) {
      this.player.setVelocityY(-50);
    } else {
      this.player.setVelocityX(0);
    }

    updateMap();
  }
}