1
\$\begingroup\$

enter image description here

When I draw these textures on screen, I put them in a sprite and specify a width and height to draw the sprites in like this:

new Sprite({
  width: 10,
  height: 10,
  texture: greenTileTexture
});

This draws the sprite at size 10x10 on screen. Let's say I want to have tile size of 10. I use this:

// This is the size of the textures as in png.
let textureWidth = greenTileTexture.width;
let textureHeight = greenTileTexture.height;
let textureRatio = textureWidth / textureHeight;

// This is the size that draws on screen.
let spriteWidth = 10;
let spriteHeight = 10 / textureRatio;

Now for the 3x2 tile I don't know what the width should be since it takes more tiles.

I want to draw isometric tiles with arbitrary tile sizes. For example above picture there are 1x1 and 3x2 sized tiles.

The textures have arbitrary height because of decoration. a is the tile's height b is texture's height c is tile's width. I can't figure out what the sprite size should be when I lay these out on screen.

Maybe I should have exact tile sizes cover the whole texture without decorations (a == b). But still what the sprite size should be?

\$\endgroup\$
1
  • 4
    \$\begingroup\$ It's not clear to me what you're asking here. It looks like you've already created sprites at particular sizes - what do you need from us? \$\endgroup\$
    – DMGregory
    Jul 5 '20 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.