From 1ec5a8d088f599d094f387abc6014f228607b605 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 2 Mar 2024 01:07:55 -0700 Subject: add interactable component --- src/components/GameCanvas.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/GameCanvas.tsx') diff --git a/src/components/GameCanvas.tsx b/src/components/GameCanvas.tsx index 5cb40a6..0ea7180 100644 --- a/src/components/GameCanvas.tsx +++ b/src/components/GameCanvas.tsx @@ -8,10 +8,10 @@ export interface GameCanvasProps { export const GameCanvas = ({ width, height }: GameCanvasProps) => { const canvasRef = useRef(null); - const [_game, setGame] = useState(); + const [game, setGame] = useState(); useEffect(() => { - if (canvasRef.current) { + if (canvasRef.current && !game) { const canvas = canvasRef.current; const ctx = canvas.getContext("2d"); if (ctx) { -- cgit v1.2.3-70-g09d2