I added an image to the canvas as a sprite, and scaled it down using .setScale(0.36)
.
The problem is that the image looks pixelated (while the image file itself is in high res).
Before I scaled down the image it looked just fine. The problem only occurs after the scaling.
This is the image file that I imported into phaser 3 (scaled, in the image viewer of my computer):
And this is how it looks on the canvas in phaser (the tint here is different, but it doesn’t matter):
As you can see, the result is very pixelated.
How can I overcome this?
Thanks a lot in advance
Here is a shortened version of my code:
var config = {
backgroundColor: "#ffb3c9",
type: Phaser.WEBGL,
width: 600,
height: 600,
parent: "pageContent",
physics: {
default: "arcade",
arcade: {
gravity: { y: 200 },
},
},
scene: {
preload: preload,
create: create,
},
};
var game = new Phaser.Game(config);
function preload() {
this.load.image("img", "img.png");
}
function create() {
var sprite = this.add.sprite(50,50,"img").setScale(0.36);
sprite.tint = 0x000000;
}