@json2d/react-snake-lib
v1.0.9-next.8
Published
A highly customizable snake game created using React
Downloads
1
Readme
Snake Game Lib
A highly customizable snake game component created using React.js
Installation
npm i @json2d/react-snake-lib
Usage
You can use it simply by
<Snake />
Or you can customize it
<Snake
startOnLoad
initialSnake={[
{ x: 2, y: 0 },
{ x: 2, y: 1 },
{ x: 2, y: 2 },
{ x: 2, y: 3 },
{ x: 2, y: 4 },
]}
initialDirection="down"
onScoreChange={onScoreChange}
onGameOver={onGameOver}
onGameStart={onGameStart}
width="500px"
height="500px"
bgColor="silver"
innerBorderColor="#b1b0b0"
snakeSpeed={90}
borderColor="black"
snakeColor="#3e3e3e"
snakeHeadColor="#1a1a1a"
appleColor="tomato"
borderRadius={5}
snakeHeadRadius={1}
borderWidth={0}
shakeBoard={true}
boxShadow="rgba(100, 100, 111, 0.2) 0px 7px 29px 0px"
size={16}
startGameText="Start Game"
startButtonStyle={{
color: "white",
padding: "6px 20px",
backgroundColor: "#1a1a1a",
borderRadius: "10px",
fontSize: "17px",
fontWeight: "600",
cursor:"pointer"
}}
startButtonHoverStyle={{
backgroundColor: "#4f4d4d"
}}
noWall={false}
/>
Publish
npm run build-lib
npm publish --access public