MZ Mouse Movement Indicator Plugin

Hi, for the game I am developing, since it will be mainly played with the mouse, I had thought of changing the indicator when you click the mouse at a point on the map. Instead of the white square, I wanted to put something custom and search on the internet I found this plugin:

Code:
Sprite_Destination.prototype.createBitmap = function() {
  this.bitmap = ImageManager.loadSystem('Cursor');
  this.setFrame(0, 0, 48, 48);
  this.anchor.x = 0.5;
  this.anchor.y = 0.5;
};

Sprite_Destination.prototype.updateAnimation = function() {
    this._frameCount++;
    this._frameCount %= 20;
    if (this._frameCount > 10) {
        this.setFrame(48, 0, 48, 48);
    } else {
        this.setFrame(0, 0, 48, 48);
    }
    this.opacity = 255;
    this.scale.x = 1;
    this.scale.y = this.scale.x;
};

the plugin works, but as soon as I change map the indicator disappears, any point I click no longer appears. I tried to fix it but couldn't, so if anyone can give me a hand I would be grateful.

Why not just use this?
MZ destroys the destination sprite's bitmap, to avoid a memory leak. However, since your code is using an image from file, you don't want that to happen. Add this line to the plugin:
JavaScript:
delete Sprite_Destination.prototype.destroy;
I.e. revert to the inherited destroy method.

@SGHarlekin - it looks like Phileas's plugin does not support loading an image from file?
MZ destroys the destination sprite's bitmap, to avoid a memory leak. However, since your code is using an image from file, you don't want that to happen. Add this line to the plugin:
JavaScript:
delete Sprite_Destination.prototype.destroy;
I.e. revert to the inherited destroy method.

@SGHarlekin - it looks like Phileas's plugin does not support loading an image from file?
I see. Welp, I'm sure there are others, but you've already provided a viable solution anyway.
Yea; here are a couple of existing plugins off the top of my head:
Krimer has one but you'll need to add the destroy patch I described.
ok i solved it, thank you all for the answers

Original thread: https://forums.rpgmakerweb.com/threads/mouse-movement-indicator-plugin.178804/