Update() function not working

Hi all, I am trying to convert this post to phaser 3: Phaser Coding Tips 2: Creating a game like Tanks / Worms, Part 2 - Learn - Phaser
but the update() function not working. In file a.ts I create a canvas texture:

    this.textures1 = this.textures.createCanvas('canvastextures1', 450, 170)
    this.land1 = this.textures.get(MAPOPTIONS.BASE1_NAME).getSourceImage()
    this.textures1.draw(0, 0, this.land1)
    this.textures1.context.globalCompositeOperation = 'destination-out'

and in file b.ts, in overlap() function:

      this.activeTextures = this.textures.get('canvastextures1')
      this.activeTextures.context.beginPath()
      this.activeTextures.context.arc(Math.floor(overlap2.x-tile.getTopLeft().x), Math.floor(overlap2.y-tile.getTopLeft().y), 50, 0, Math.PI * 2, false)
      this.activeTextures.context.fill()
      this.activeTextures.update()

Does anyone have any ideas? Thank you.

I can’t say for sure without looking at the entire code, but after your this.textures1.draw(0,0,this.land1), where is the line to actually display the created canvas texture to the screen by adding image to the Phaser scene?
so something like;
this.textures1.draw(0, 0, this.land1);
this.add.image(0,0,‘canvastextures1’).setOrigin(0);

You might like to post the relevant code as Codepen?

1 Like