fix: update spritesheet and data

This commit is contained in:
trafficlunar 2024-12-21 16:53:52 +00:00
parent 01bb44965d
commit 94e560a60d
7 changed files with 7 additions and 731 deletions

View file

@ -31,7 +31,7 @@ function Blocks({ blocks, setBlocks, textures, image, imageDimensions, coords, s
tilemap.clear();
blocks.forEach((block) => {
tilemap.tile(textures[block.name] ?? missingTexture, block.x * 16, block.y * 16);
tilemap.tile(textures[`${block.name}.png`] ?? missingTexture, block.x * 16, block.y * 16);
});
};

View file

@ -10,6 +10,9 @@ function SelectedBlock() {
const { selectedBlock } = useContext(ToolContext);
const convertToDataUrl = (textureName: string): string => {
// Show missing texture if fail
if (!textures["stone"])
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGUlEQVR42mPABX4w/MCKaKJhVMPgcOuoBgDZRfgBVl5QdQAAAABJRU5ErkJggg==";
const texture = textures[textureName];
const canvas = document.createElement("canvas");