If I loaded an image using
game.load.image(‘object’, ‘assets/sprites/car.png’);
how can I replace that image using the same key?
for example
game.load.image(‘object’, ‘assets/sprites/house.png’);
This is talking about “cache” not about displayed images on the scene.
The problem is that if a load a new image using the same key when I try to add a new image/sprite(game.add.image) using that key I see the first image not the second one.
I load the new image using the load method and adding a event to know when the image was loaded and in the event I add the new image on the scene but if I used the same key I got the old image and if I use a different key then I got the new image.
I dont’ want to have different keys because I only need 1 image at time and I don’t want to preload hundred of images because I just need 1 and because loading hundred of images takes some time before the game starts running.
Or how I can remove from memory/cache the image? I can’t see a method for Phaser 3 only for previos versions.