excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️

Home Page:https://excaliburjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scaling a tilemap breaks clipping.

thefakeplace opened this issue · comments

commented

Steps to Reproduce

Create a tilemap and apply scaling to it.

const createTilemap = () => {
  const tilemap = new TileMap({
    rows: 16,
    columns: 16,
    tileWidth: SHEET_TILE_WIDTH,
    tileHeight: SHEET_TILE_HEIGHT,
  });

  for (const cell of tilemap.tiles) {
    const sprite = spriteSheet.getSprite(0
    cell.addGraphic(sprite);
  }

  tilemap.scale = vec(
    WORLD_TILE_WIDTH / SHEET_TILE_WIDTH,
    WORLD_TILE_HEIGHT / SHEET_TILE_HEIGHT,
  );
  return tilemap;
};

Expected Result

Clipping works.

Actual Result

Tiles are incorrectly clipped when they leave the camera view.

Screen.Recording.2023-07-16.at.10.48.07.PM.mov

@thefakeplace Thanks for the issue! Definitely a bug!

I'll take a look at this soon 👍

As a possible work around you could look at zooming the camera Camera.zoom to get the scaling you are looking to see.

commented

Thanks! That works for me