mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 14:44:12 +00:00
feat: add block tiles
This commit is contained in:
parent
c07fb053b0
commit
98b901ca75
3 changed files with 42 additions and 10 deletions
30
src/components/blocks.tsx
Normal file
30
src/components/blocks.tsx
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue