mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
fix tiling
This commit is contained in:
parent
e923cf06c9
commit
e767b1b54b
2 changed files with 10 additions and 6 deletions
|
|
@ -106,8 +106,8 @@ async function saveTiles() {
|
|||
const img = new Image();
|
||||
img.src = url;
|
||||
img.onload = function () {
|
||||
for (let y = 0, i = 0; y < graphHeight; y += tileH) {
|
||||
for (let x = 0; x < graphWidth; x += tileW, i++) {
|
||||
for (let y = 0, i = 0; y + tileH <= graphHeight; y += tileH) {
|
||||
for (let x = 0; x + tileW <= graphWidth; x += tileW, i++) {
|
||||
ctx.drawImage(img, x, y, tileW, tileH, 0, 0, canvas.width, canvas.height);
|
||||
const name = `fmg_tile_${i}.png`;
|
||||
canvas.toBlob(blob => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue