import React, { useEffect, useRef, useState } from "react"; export default function CarRaceGame() { const canvasRef = useRef(null); const [speed, setSpeed] = useState(5); const [gameOver, setGameOver] = useState(false); const player = useRef({ x: 140, y: 400, w: 40, h: 80 }); const obstacles = useRef([]); useEffect(() => { const canvas = canvasRef.current; const ctx = canvas.getContext("2d"); let animationFrameId; const spawnObstacle = () => { const x = Math.random() * (canvas.width - 40); obstacles.current.push({ x, y: -80, w: 40, h: 80 }); }; const detectCollision = (a, b) => { return ( a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y ); }; const gameLoop = () => { ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw player ctx.fillStyle = "blue"; ctx.fillRect(player.current.x, player.current.y, player.current.w, player.current.h); // Draw obstacles ctx.fillStyle = "red"; obstacles.current.forEach((obs) => { obs.y += speed; ctx.fillRect(obs.x, obs.y, obs.w, obs.h); if (detectCollision(player.current, obs)) { setGameOver(true); } }); // Remove off-screen obstacles obstacles.current = obstacles.current.filter((obs) => obs.y < canvas.height); if (Math.random() < 0.02) spawnObstacle(); if (!gameOver) { animationFrameId = requestAnimationFrame(gameLoop); } else { ctx.fillStyle = "black"; ctx.font = "30px Arial"; ctx.fillText("Game Over", 100, 250); } }; gameLoop(); return () => cancelAnimationFrame(animationFrameId); }, [speed, gameOver]); useEffect(() => { const handleKeyDown = (e) => { if (e.key === "ArrowLeft") player.current.x -= 20; if (e.key === "ArrowRight") player.current.x += 20; }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); }, []); return (
); } LETS APPRECIATE ART.

Thank you for being here. art is quite incredible. its seen all over the world as a source of entertainment, leisure activity and a form of therapy and expression. the shapes and color evoke deep feelings in people. its a sort of deep awakening . we all appreciate the various forms of art that are displayed all around the world.

                when you visit art galleries, you will be amazed at how creative people can get.                       some people draw inspiration for art from many areas. some claim to dream dreams. others draw from nature, others use own experiences, dark or happy, to create artwork.                        

Many people appreciate art as a source of income. there are many channels that influencers use to explain how to draw, paint etc. they earn from these views. also,paintings worth billions have been sold and continue to be sold all around the world.                             Art has been used as interior decor. dull houses burst to life after some form of art is added. the vibrant colors in most paintings make houses look gorgeous.

                        Art has been used since the beginning of time. ancient drawings have been excavated in many areas. its a widely accepted method of preservation of history. the ancient drawings give us an indepth look at how those people lived.                    

we also appreciate the art we see when people dress up. its in the designs, the make up, the hairdo, in the accessories and we do love it.

                                we cannot forget the art in poems, songs, drama and in the spoken word. its terribly entertaining.                    

Learn to appreciate art. you just might enjoy it, if currently you aren't an art enthusiast.

                  FIND ME HERE to connect on facebook. follow for more. thank you     we can connect anytime, anywhere all around the world