Closed JernejHabjan closed 10 months ago
FIxed by creating own tiles
Still happens when scrolling inwards and outwards. Also reported here https://github.com/phaserjs/phaser/issues/6674
https://github.com/sporadic-labs/tile-extruder?tab=readme-ov-file#usage-as-a-library
tile-extruder --tileWidth 64 --tileHeight 32 --input tiles.png --output tiles.png
tile-extruder --tileWidth 64 --tileHeight 32 --input tiles_2.png --output tiles_2.png
Before:
After: Black dots disappear, but these jagged edge is shown. Same here:
Not sure if I can fix this
Not fixing atm as there's no good solution. One Solution is to keep tiles same dimension as they are and introduce no tile extrusion, but just extrude tile manually only on bottom part, The issue here would be that bottom of the tile would be jagged if multiple are stitched together
Conversation on Tiled forum also here: https://discord.com/channels/524610627545595904/524610627545595906/1200151476341846027
This can be worked around when zooming in and out:
private zoomIn(): void {
const newZoom = this.mainCamera.zoom * 2;
const validZoom = this.findNearestValidZoom(newZoom);
if (validZoom <= this.cameraMinZoom) {
this.mainCamera.zoom = validZoom;
}
}
private zoomOut(): void {
const newZoom = this.mainCamera.zoom * 0.5;
const validZoom = this.findNearestValidZoom(newZoom);
if (validZoom >= this.cameraMaxZoom) {
this.mainCamera.zoom = validZoom;
}
}
private findNearestValidZoom(zoom: number): number {
const powersOfTwo = [0.5, 1, 2, 4, 8, 16]; // Adjust as needed
let nearest = powersOfTwo[0];
for (const power of powersOfTwo) {
if (Math.abs(zoom - power) < Math.abs(zoom - nearest)) {
nearest = power;
}
}
return nearest;
}
Making sure you're zooming in and out by powers of 2 so we don't get rounding issue which would cause these artefacts
Finally fixed with this zoom
extrude tiles
https://github.com/photonstorm/phaser/issues/6460