项目作者: petabite

项目描述 :
plain vanilla javascript snake
高级语言: HTML
项目地址: git://github.com/petabite/JSnake.git
创建时间: 2020-08-21T20:48:39Z
项目社区:https://github.com/petabite/JSnake

开源协议:MIT License

下载


JSnake

super plain vanilla javascript snake

demo

▶️▶️PLAY HERE◀️◀️

How to Play

  1. clone repo
  2. open jsnake.html in your fav browser
  3. have fun!

Game Configuration

change these parameters to your liking

html

  1. <!--you can change the size of the canvas!-->
  2. <canvas id="snake" width="500" height="500"></canvas>

js

  1. const CANVAS_ID = "snake"; // id of canvas to render game in
  2. const GAME_SPEED = 250; // in ms
  3. const SNAKE_SIZE = 25; // width of cell in grid in pixels
  4. const CANVAS_COLOR = "#000000"; // background color
  5. const FOOD_COLOR = "#FF0000";
  6. const SNAKE_COLOR = "#00FF00";
  7. const SNAKE_BORDER_COLOR = "#007a1d";
  8. const SNAKE_BORDER_SIZE = 3; // width of border in pixels

Feel free to embed on your own site!