BitMapData not showing up

I’m trying to get the ‘graas.png’ to show as BitMapData:

var game = new Phaser.Game(1240, 540, Phaser.CANVAS, "phaser-example", {
  preload: preload,
  create: create,
  update: update
  // render: render
});

var canin, canin2, wepin, wepin2, cursors, map, tileset, turn, platforms, land;

function preload() {
  this.load.image("backdrop", "/Blis.png");
  this.load.image("cannon", "https://i.ibb.co/FH5ZqwL/Canin.png");
  this.load.image("cannon2", "/caninFlipt.png");
  this.load.image("comet", "https://i.ibb.co/W0rgWwf/Fireball.png");
  this.load.image("terayn", "/graas.png");
  this.load.tilemapTiledJSON("map", "/Terrayn.json");
  this.load.image("tiles", "/TS.png");
}

function create() {
  turn = true;
  canin2 = this.add.sprite(494, 428, "cannon2");
  game.physics.arcade.enable(canin2);
  canin = this.add.sprite(94, 228, "cannon");
  game.physics.arcade.enable(canin);
  land = this.add.bitmapData(1240, 540);
  land.draw("terayn");
  land.update();
  land.addToWorld();
  wepin = this.add.weapon(30, "comet");
  // wepin.bulletGravity = 60;
  wepin.bulletSpeed = 200;
  wepin.trackSprite(canin, 18, -10, true);
  wepin2 = this.add.weapon(30, "comet");
  // wepin.bulletGravity = 60;
  wepin2.bulletSpeed = 200;
  wepin2.trackSprite(canin2, 0, 0, true);
  this.input.keyboard.on("keydown_SPACE", function (event) {
    console.log("yo");
    wepin.fire();
  });
  // wepin = this.physics.add.sprite(canin.x, canin.y, "comet");
  // wepin.visible=false;
}

function update() {
  cursors = this.input.keyboard.createCursorKeys();
  if (turn) {
    if (cursors.left.isDown) {
      canin.body.angularVelocity = -90;
    } else if (cursors.right.isDown) canin.body.angularVelocity = 90;
    else canin.body.angularVelocity = 0;
    // this.world.wrap(sprite, 16);
  } else {
    if (cursors.left.isDown) {
      canin2.body.angularVelocity = -90;
    } else if (cursors.right.isDown) canin2.body.angularVelocity = 90;
    else canin2.body.angularVelocity = 0;
    // this.world.wrap(sprite, 16);
  }
}

But nothing shows up:

The Game

Why are you using such an old version?

Anyway, replace

land.update();
land.addToWorld();

with

this.add.sprite(0, 0, land);

Do you have a console error like

Unable to get image data from canvas because the canvas has been tainted by cross-origin data.

?

Thanks Milton - that solved it.

However I tried to make the land static using

land.body.static =true;

but it doesn’t seem to be static. How shall I do it?

no I wasn’t getting that

but thanks

Hi thanks Milton.

I’ve made some changes but no luck with collision detection. I made a fresh topic: Collision/Overlap not detecting