feat: add block tiles

This commit is contained in:
trafficlunar 2024-12-04 18:25:44 +00:00
parent c07fb053b0
commit 98b901ca75
3 changed files with 42 additions and 10 deletions

30
src/components/blocks.tsx Normal file
View file

@ -0,0 +1,30 @@
import { useState } from "react";
import { Image } from "react-konva";
import useImage from "use-image";
function Blocks() {
const [image] = useImage("/blocks/programmer-art/stone.png");
const [blocks, setBlocks] = useState<Block[]>([
{
name: "stone",
x: 0,
y: 0
},
{
name: "stone",
x: 1,
y: 1
},
]);
return (
<>
{blocks.map((block, index) => (
<Image key={index} image={image} x={block.x * 16} y={block.y * 16} />
))}
</>
);
}
export default Blocks;