diff --git a/.vscode/preview.yml b/.vscode/preview.yml new file mode 100644 index 00000000..dec71565 --- /dev/null +++ b/.vscode/preview.yml @@ -0,0 +1,9 @@ +# .vscode/preview.yml +autoOpen: true # 打开工作空间时是否自动开启所有应用的预览 +apps: + - port: 8080 # 应用的端口 + run: npm -v; npx --yes http-server # 应用的启动命令 + root: ./ # 应用的启动目录 + name: JavaScript-Snake # 应用名称 + description: JavaScript-Snake # 应用描述 + autoOpen: true # 打开工作空间时是否自动开启预览(优先级高于根级 autoOpen) diff --git a/README.md b/README.md index 7942c5ff..1173ca07 100755 --- a/README.md +++ b/README.md @@ -1,23 +1,16 @@ # JavaScript Snake Game -This is a DOM-based game of Snake that I wrote in JavaScript over a decade ago. It was made to have sort of a nostalgic feel to it. +这是一个基于DOM的贪吃蛇游戏,是十多年前用JavaScript编写的,它被设计的有一种复古的风格。 +## 在线玩游戏! -## Play and Edit the Game Online! - -You can now play and edit the game live in codesandbox: - -https://codesandbox.io/s/github/patorjk/JavaScript-Snake?file=/index.html - -On first load sometimes the game frame will not load correctly and you'll need to press the refresh icon above its display panel to get the game to show. - -Original game is located here: +原版游戏在这里: http://patorjk.com/games/snake -## How to use -The index.html file should give an idea of how to use this code. However, below you can see how to initialize it into any div within a webpage. - +## 如何使用 + index.html 文件应该给出怎么使用此代码的用法,但是您可以在下面看到将其初始化到网页内的任何div中. + var mySnakeBoard = new SNAKE.Board( { boardContainer: "game-area", fullScreen: false, @@ -25,4 +18,4 @@ The index.html file should give an idea of how to use this code. However, below height:400 }); -The comments within the source code are formatted a little strange because at the time I was playing around with YUI Doc which generates documentation from code. Kind of sucks that there's so much churn in the JavaScript world. However, I'm glad the rest of the code doesn't use any external libraries, as this game still works the same after over a decade. +源代码中的注释格式有点奇怪,因为我当时正在使用YUI Doc,它可以从代码生成文档。JavaScript世界里有如此多的混乱很多混乱的东西,这有点糟糕。但我很高兴其余的代码没有使用任何外部库,因为这个游戏在十多年后仍然可以正常工作。 diff --git a/css/main-snake.css b/css/main-snake.css index 82a05adb..5623c07e 100755 --- a/css/main-snake.css +++ b/css/main-snake.css @@ -67,10 +67,10 @@ a.snake-link:hover { } .snake-snakebody-alive { - background-image: url('./css/images/snakeblock.png'), url('./images/snakeblock.png'); + background-image: url('./images/snakeblock.png'), url('./images/snakeblock.png'); } .snake-snakebody-dead { - background-image: url('./css/images/deadblock.png'), url('./images/deadblock.png'); + background-image: url('./images/deadblock.png'), url('./images/deadblock.png'); } .snake-food-block {